Fileserver fun
This week, when I noticed that 500GB drives had gone down to $99 at Canada Computers, I decided to upgrade my file server.
I use mdadm, a Linux-based software RAID solution, to handle the array. For the non-technical, this means that if I have four hard drives I can combine them into one big drive with a certain percentage of the space reserved for parity data. This parity data acts as a safety net: if any one of the hard drives die, the missing contents of that drive can be calculated from the data on the remaining drives. It's magic!
When the two extra drives were installed, the array had to be grown to use them. The documentation for doing this is kind of scattered all over the place so I wanted to record the steps I went through in one place:
Notes
My raid device:
/dev/md0 (ext3 filesystem)
Existing drives in the array:
/dev/sdb, /dev/sdc, /dev/sdd, /dev/sde
Newly installed drives:
/dev/sdf, /dev/sdg
Add the two extra drives
mdadm --add /dev/md0 /dev/sdf
mdadm --add /dev/md0 /dev/sdg
Grow the array
mdadm --grow /dev/md0 --raid-devices=6
Increase the default speed of the growth (For me this meant the difference between taking 125 hours to complete and just 12 hours)
echo 1000000 > /proc/sys/dev/raid/speed_limit_max
echo 50000 > /proc/sys/dev/raid/speed_limit_min
Watch and wait for the growth of the array to finish
watch cat /proc/mdstat
Do a filesystem check
e2fsck -f /dev/md0
Resize the filesystem to match the new array size
resize2fs /dev/md0
Isn't Linux ridiculously simple? If you're using /etc/mdadm.conf don't forget to update it with the new value for num-devices.
Read the full article
