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
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
- Reboot into Ubuntu “Ubuntu (Linux distribution)”) LiveCD, don’t forget to upgrade the software on the LiveCD to prevent any issues!
- Disable swapspace (
cfdiskto 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 (
- Stop any services that depend on
/etc/init.d/mythtv-backend stop; /etc/init.d/mpd stop).
- Unmount the data drive (
- Add the new physical volumes to the current LVM volume group,
vgextend raid5 /dev/md3).
- Expand the logical volume to the full size of the volume group (use
pvdisplayto find out the size [411.05GB], and then run
lvextend -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) - running
e2fsckon a 600GB drive does take a while… Took about 30 minutes for me with little else running.
- Remount the data drive (
- 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
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
If this post helps you, please let me know in the comments.