mdadm: Add a hot-spare after failing a disk

Once the disk is failed (or is actually defective), mdadm will automatically remove it from the RAID. After that, you’ll either have to add the disk back as a data disk or as a hot-spare (which was in my case). Now, here’s after the rebuild for the failed disk started: 1 2 3 4 5 6 7 8 root:(charon.ka.heimdaheim.de) PWD:~ Sun Jul 27, 23:40:35 [0] > cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] md127 : active raid5 sdi1[0] sdh1[6] sdj1[7] sdk1[8] sdf1[9] sdb1[5] sde1[4] sdd1[2] sdc1[1] 15626121216 blocks super 1.2 level 5, 512k chunk, algorithm 2 [9/8] [UUUUU_UUU] [===================>.] recovery = 97.9% (1913176308/1953265152) finish=12.3min speed=53936K/sec unused devices: <none> In order to add the replaced disk back to the RAID, you’ll have to prepare a partition for it (see this post for more details). After that, it’s a simple call with mdadm to re-add the hot-spare: ...

July 27, 2014 · 3 min · 472 words · christian

mdstat

Well, I needed a way to watch the mdstat progress (because a disk just failed …). 1 2 3 #!/bin/bash watch -n1 cat /proc/mdstat

July 27, 2014 · 1 min · 24 words · christian

Linux NAS optimizations

Well, I recently had to flatten my archive NAS (well only the OS part … wheeeh). Since I didn’t have the chance to backup the old settings I had to do everything from scratch … And this time I decided, I wasn’t doing a script but rather the proper way. I spent a while reading through the Internetz about the various settings until I stumbled upon a Frauenhofer Wiki entry. From there I ended up writing those udev-rules and the sysctl configs… ...

July 9, 2014 · 4 min · 685 words · christian

SFdisk - Partition table for 2TB RAID-Disks

So, when I create (or add RAID disks) I have this handy sfdisk template (I created once when I first added the 2TB disks): 1 2 3 4 5 6 7 root:(charon.ka.heimdaheim.de) PWD:~ Wed Jul 09, 15:13:04 [0] > sfdisk -d /dev/sdj > ~/raid-disk-template.sf root:(charon.ka.heimdaheim.de) PWD:~ Wed Jul 09, 15:13:04 [0] > cat ~/raid-disk-template.sf # partition table of /dev/sdj unit: sectors /dev/sdj1 : start= 2048, size=3906793472, Id=da So, if I wanted to add more disks, I’d just have to run the following: ...

July 9, 2014 · 1 min · 100 words · christian

More MD weirdness

Well, at last I’m getting somewhere with my troubles. This only seems to be happening when creating an RAID5 multiple device with four disks, this doesn’t happen with three. Now, the next thing I tried was to create a three disk array, and then adding the fourth disk as spare and then extending the array with that fourth disk. After that, all these errors seem to appear again yuck So I either possess rather faulty disks, or something else is fishy, since I’m having another four disk RAID5 array with the old disks …

December 29, 2008 · 1 min · 94 words · christian