I told you about moving my data over to a RAID1+0 and RAID5 system in this previous post, but, as expected, I never got round to finishing it. Until now, that is…
I went to London on business for a few days, and came back to find
MythTV had stopped working. The disk
was full, so it had given up, and wouldn’t even let me get in to view
the recordings - so I couldn’t even delete some to get it working again!
(I wonder why Auto-Expire wasn’t working.) Anyway, this spurred me on to
finally finish partitioning/setting up my drives. The process was quite
simple, really. The following steps generally assume you are root
already (sudo su
) because I am a “bad” sysadmin and don’t believe in
all this constant sudo
malarchy. Following my instructions is, as
always, at your own risk. I highly recommend that you read the relevant
documentation before proceeding (such as
this).
- Reboot into Ubuntu “Ubuntu (Linux distribution)”) LiveCD, don’t forget to upgrade the software on the LiveCD to prevent any issues!
- Disable swapspace (
swapoff /dev/sd[abcd]1
). - Use
cfdisk
to finish formatting the drives (remembering to change partition types to the hexadecimal “fd” - Linux RAID Autodetect). Be careful NOT to modify ANY of the details of the partitions you are already using for data or you will probably lose data! - Reboot back into your real system (not LiveCD - minimizes downtime).
- Optional: add hot spares to current RAID5 devices
(
mdadm /dev/md1 -a /dev/sdf5
). - Create the new RAID6 devices
(
mdadm -C /dev/md3 -l6 -n6 /dev/sd[abcdef]7
). - Optional: wait for the devices to finish resyncing
(
watch cat /proc/mdstat
). - Turn the new RAID devices into
LVM “Logical Volume Manager (Linux)”)
physical volumes (
pvcreate /dev/md3
). - Stop any services that depend on
/data
(/etc/init.d/mythtv-backend stop; /etc/init.d/mpd stop
). - Unmount the data drive (
umount /data
). - Add the new physical volumes to the current LVM volume group,
“
raid5
” (vgextend raid5 /dev/md3
). - Expand the logical volume to the full size of the volume group (use
pvdisplay
to find out the size [411.05GB], and then runlvextend -L+411.05G /dev/raid5/data
). - Expand the filesystem [ext3] to the full size of the logical volume
(
e2fsck -f /dev/raid5/data; resize2fs /dev/raid5/data
) - runninge2fsck
on a 600GB drive does take a while… Took about 30 minutes for me with little else running. - Remount the data drive (
mount /data
). - Restart the services you stopped eariler
(
/etc/init.d/mythtv-backend start; /etc/init.d/mpd start
). - Remember to update (I prefer to re-create) your initramfs and update
grub (
update-initramfs -k all -c; update-grub
) - All done!
I chose RAID6 over 6 disks over RAID5 over 5 disk with one hot spare because it has better redundancy and similar performance. It was added to the kernel at the end of 2003 so I think it should be fairly stable by now.
This process was not too complicated, and all of this can be
done with very little downtime (if you are clever/daring, you can even
re-partition without rebooting, but that was too risky for me!). You can
even do the LVM stuff without taking /data
offline! I wouldn’t advise
it though.
If this post helps you, please let me know in the comments.