Jan 11 2009
Maintenance on Leandra is finished. I took her offline around 2100 ESET5EDT on Saturday night to remove a dead DVD-ROM drive, remove a pair of 512GB memory modules that weren't doing anything, and swap out her 250 GB hard drive for a 500 GB drive. The RAID array has had 250 GB added to it; specifically, the logical volume holding everything but the /boot and / partitions has had 250 GB added to it. 15 GB from the free pool was added to /usr (so that more software could potentially be installed) and the rest of the free disk space was added to /home (where everyone's files and web content are kept).
In case you're curious about how I did it, the procedure is under the cut. If you're not interested, don't worry about it.
- Mark the partitions from /dev/sdb (the smaller hard drive) bad so they can be removed from the array: mdadm /dev/md0 --fail /dev/sdb1 && mdadm /dev/md0 --remove /dev/sdb1 (/boot)
- mdadm /dev/md1 --fail /dev/sdb2 && mdadm /dev/md1 --remove /dev/sdb2 (/)
- mdadm /dev/md2 --fail /dev/sdb4 && mdadm /dev/md2 --remove /dev/sdb4 ([this is the physical volume])
- Deactivate the second swap partition: swapoff /dev/sdb3
- Shut down, disconnect everything, perform hardware modifications.
- Boot into single user mode.
- Clone the partition table of /dev/sda to /dev/sdb: sfdisk -d /dev/sda | sfdisk /dev/sdb
- Add the new partitions to the mirrors: mdadm /dev/md0 --add /dev/sdb1
- mdadm /dev/md1 --add /dev/sdb2
- mdadm /dev/md2 --add /dev/sdb4
- Create a new swap partition on the second drive: mkswap /dev/sdb3 && swapon /dev/sdb3
- Wait for the mirrors to finish synching: while true; do cat /proc/mdstat; sleep 15; done
- Expand the LVM's RAID to encompass all of the new disk space: mdadm --grow /dev/md2 --size=max
- Expand the physical volume to encompass all of the new space in the RAID: pvresize /dev/md2
- Add 15 GB to /usr: lvextend -L+15G /dev/leandra/usr && resize_reiserfs /dev/leandra/usr
- Get an idea of how many extents are left unused in the physical volume so that /home can be maxed out: lvresize -L+600G /dev/leandra/home
- Take note of the number of extents that aren't in use (in Leandra's case, 60,690)
- Add the number of free extents to /home: lvresize -l+60690 /dev/leandra/home && resize_reiserfs /dev/leandra/home
- Reboot into multi-user mode.
- That's it.
This work by The Doctor [412/724/301/703] is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.