PS! Command syntax is for example only and is not necessarily correct nor complete.
- Make sure grub is installed on both drives so the system will still boot if one drive is missing.
- Fail all partitions from one of the drives: mdadm --manage /dev/md3 --fail /dev/hdc3
- Remove the drive from the array: mdadm --manage /dev/md3 --remove /dev/hdc3
- Shutdown server, and replace the drive with a bigger one.
- After reboot, create the same number of partitions that was on the old drive. Each partition must be at least as big as the one it is replacing.
- Add the new partitions to the array: mdadm --manage /dev/md3 --add /dev/hdc3
- Let them fester.. i mean rebuild. You can check the status by: cat /proc/mdstat
- Once finished rebuilding, repeat step 2-7 for the other drive.
- I now had an identical array to the one on the old drives, except i have space to resize the filesystem to make use of any extra space on the new partition scheme.
- First we need to make the array partition make use of all the available storage on the harddrive partitions: mdadm --grow /dev/md3 --size=max
- Online resizing doesn't work for mounted filesystems, and the system disks can't be unmounted while in use. So, reboot into a rescue CD. I chose gParted.
- Then re-created the raid array with the second drive missing. mdadm --create /dev/md3 --level=1 --raid-devices=2 /dev/hdc3 missing
- Ran fsck -n /dev/md3
- Removed the journaling from my ext3 filesystem (making it into an ext2 fs basically): tune2fs -O ^has_journal /dev/md3
- Ran e2fsck -f /dev/md3
- Ran resize2fs /dev/md3 and waited a fair amount of time.
- Once more ran fsck -n /dev/md3
- Before re-enabling the journaling: tune2fs -j /dev/md3
- Just to be sure, i rebooted into gParted once more, and created the array again just as in step 12.
- I then added the second drive to the array: mdadm --manage /dev/md3 --add /dev/hda3
- Sat back and watched: watch -n 1 'cat /proc/mdstat' for a long time while the second drive got rebuildt with the new filesystem size.
Before I edited the file it did not contain any settings. I basically just added definitions for the arrays i have on my system disks, and listed the partitions to use for each of them.
You might wonder why I did not add both drives to the array BEFORE I resized the file system. And yes, you can indeed do this. It would probably even be faster! But: REMEBER TO MAKE A BACKUP! With my approach I had the second drive as a backup in case something went boom on the first drive.