Driver canon pixma ip1880 window 7, Lease termination format india, Gangstar rio city of saints for windows xp, Epson stylus c41sx windows 7 driver, Ios 7 beta 6 legal ipsw iphone 5, Kalavar king telugu movie mp3 songs, Riff for ubuntu 13.04, Diablo 2 lod able items, Cults static zip, I am the bread of life

Reshaping mdadm from RAID1 to RAID5

I recently obtained a new dedicated server from the SoYouStart section of OVH. With 4 x 2TB disks, it has more than enough space.

Except it was all in a RAID1 configuration. A little excessive, and I tend to run RAID5. I needed to reshape this, and whilst there was no data on the server yet bar an operating system, I thought I should take note, and experiment with the information provided at https://serverfault.com/a/1032480

Firstly, use the SYS Control Panel to enable the netboot rescue environment, and then reboot the server.

Once it comes online, OVH will have emailed a temporary root password, along with the relevant username and IP address. SSH to the machine.

Check the disks, and for my own sanity I reduced the main filesystem to 10GB, not that it really helps.

e2fsck -f /dev/md127
resize2fs /dev/md127 10G

Next, since there is a path from 2 disk RAID1 to RAID5, fail and remove two of the four disks.

mdadm /dev/md127 --fail /dev/sdc2
mdadm /dev/md127 --remove /dev/sdc2
mdadm /dev/md127 --fail /dev/sdd2
mdadm /dev/md127 --remove /dev/sdd2

You are now left with an intact two disk RAID1 array.

mdadm --detail /dev/md127

Confirm to mdadm that it should be a two disk array.

mdadm --grow /dev/md127 -n2
mdadm --detail /dev/md127

Another forced filesystem check for my own sanity.

e2fsck -f /dev/md127

Now, grow the array to be a RAID5 array

mdadm --grow /dev/md127 -l5
mdadm --detail /dev/md127

It should confirm that the array is clean, albeit only with two drives. Now you can add the disks that were previously removed.

mdadm /dev/md127 --add-spare /dev/sdc2
mdadm /dev/md127 --add-spare /dev/sdd2
mdadm --detail /dev/md127

It should confirm that they have been added, but they are as the command indicated, spares.

Now that the disks are part of the array, the array can be grown to include all the disks as part of the RAID5 set.

mdadm --grow /dev/md127 -n4
mdadm --detail /dev/md127

The reshape process will take a while, but you can watch it with… watch, and cat

watch -n1 cat /proc/mdstat

After all the heavy lifting is complete, resize the filesystem back to use the full array

resize2fs /dev/md127

The server can now be edited in the Control Panel to return to booting from the hard drive, and then rebooted. Since the original array has been kept, the UUID returned by blkid should have stayed the same, and thusly all the Grub bootloaded and fstab entries should not need adjusted.