Mdadm: Swapping out small hard drives for bigger ones in a RAID5, How to partition

mdadmpartitionraid5swapping

So I got the gist of swapping out smaller hard drivers for bigger ones in an MDADM RAID5:

Fail and remove one drive.

mdadm -f /dev/md0 /dev/sdd1
mdadm -r /dev/md0 /dev/sdd1

Shutdown, swap the hard drive, partition and add back to array

mdadm --add /dev/md0 /dev/sdd1

Wait for resync and continue with all the remaining drives.

Finally grow the array

mdadm --grow /dev/md0 --size=max

My question is how do you partition the new bigger drives? I see different instructions around the net and I know most of them are outdated so I wanted to see if anyone has done it recently.

  1. Partition the new drives to be the same size as the old drives in the array

  2. Partition the new drives to be the maximum size of the drive.

I have a really simple setup, 4 drives RAID5 350GB each. I only have one partition on each drive and build a single array. This is a data archive disk so no need for multiple arrays or partitions.

The other approach I am thinking is backup to one drive, build a 3 drive array, add the backup drive to the array. That is:

  • Remove one drive (350GB)
  • Add a new drive (1TB)
  • Backup all my data into the new drive (my raid data will fit in a new drive)
  • Take out the remaining 3 (350GB) old drives
  • Put in the rest of the 3 (1TB) new drives
  • Build a 3 drive array
  • Copy the data to the array from the 1st new drive
  • Wipe the backup disk and add to the array to make it 4 drives.

Is this safer? Faster? Thoughts?

Best Answer

Eventually you will need to have the "raid partition" to have the maximum size of the disk; it doesn't matter if you do that upon rebuild or if you repartition once your array is renewed.

I've recently done something similar, it's fairly fast. Note that you can set the raid rebuild speed (/proc/sys/dev/raid/speed_limit_min/max), by default it's limited for background rebuilds.

Note there is one step missing in your plan: you will need to instruct the thing on top of your md-layer to grow as well (filesystem, or lvm pv, or ...)

However, if you can do it (can keep the system down for longer, invest more time and have enough disk slots) it's probably safer to copy everything onto a backup disk. The data remains in plain sight at all times, which I find comforting.

Related Topic