increase drive capacity in a raid 1 filesystem setup
January 28th, 2009 by Lawrence David
so a couple of weeks ago, i decided to upgrade the hard drives in my server. previously, i had two 160 GB drives mirrored in a RAID 1 array. there were several partitions in the array.
after an impulse newegg buy (curse you and your sales newegg!), i had two 750 GB drives i endeavored to install. things got tricky though: if i wanted to make use of the extra 590 GB of storage, i could:
- a) copy over the existing partitions and expand one of them to make use of the extra space.
- b) copy over the existing partitions and then make a new partition to occupy the new space.
since a) looked more complicated, i chose b). here’s how to do it:
- tell mdadm that you are about to remove a hard drive by failing its partitions.
- sudo mdadm /dev/md0 -f /dev/hdd1 -r /dev/hdd1
- repeat for each partition
- remove the hard drive you just failed.
- physically install the new drive where you took the old one from.
- copy over your present partition setup:
- sfdisk -d /dev/hda | sfdisk /dev/sda
- add those new partitions to your RAID:
- mdadm –manage /dev/md0 –add /dev/sda1
- create your new partition using cfdisk /dev/sda
- (note that you want to use a linux RAID autodetect logical filesystem)
- now, add the partition to your RAID using mdadm -add
- update fstab and create a new directory to mount your new partition at.
- reboot
- you may have to now make the new filesystem:
- sudo /sbin/mkfs -t ext3 /dev/md3
- return to step 1) and fail the other old hard drive.
- install the second new hard drive.
- repeat steps 4) and 5).
note that you may also have to install GRUB on the new drives to make the new RAID 1 array bootable. here’s how to install GRUB.
[...] recently installed some massive hard drives in my server box. given all that space, i thought it’d be perfect to have the mac’s [...]