Expand RAID 1 size from 500GB to 4TB in Linux

6,762

Listed below is the complete list of actions and commands that need to be performed in order to extend a RAID 1 array.

(Note: For simplicity, I am assuming that /dev/sda and /dev/sdb are the old drives and /dev/sdc and /dev/sdd are the new drives. If you are unable to figure out which drive is which, enter gnome-disks into Terminal. All of the required information for each drive can be found easily enough through the GUI.)

  1. Add the new hard drives to your computer

  2. Ensure that the new, replacement hard drives have been added to the server and are registering properly.

  3. Ensure that the new drives are partitioned to align with the current RAID configuration. For example, if your RAID array currently has two partitions, your new drives should also have at least two partitions.

In my own, there is a 64GB partition for md0, with a 576GB partition being used for md1.

(My old drives in these screenshots are sda and one that I had already removed when taking this screenshot. Ignore he Unallocated Space at the end, it was an unrelated consequence to my RAID Array involving different sized hard drives.) Old Drive

(While my new drives are sdb and sdc.) New Drive

  1. After you have confirmed that the replacement drives will be able to match the current RAID configuration, issue the following commands.

sudo mdadm --add /dev/md0 /dev/sdc1

sudo mdadm -f /dev/md0 /dev/sda1

sudo mdadm -r /dev/md0 /dev/sda1

At this point, if you have gnome-disks open you should see 64 GB RAID Array highlighted in red. This is to notify you that there was a problem with one of the disks in the array (you just removed one, so mdadm assumes it has failed, when infact, you just removed it.) Since you have already added /dev/sdc1 to md0 (the 64GB array). If you have done this successfully, it will show that the array is currently recovering, listing an ETA and the speed at which it is recovering at. If your first partition is as small as mine is, the recovery time should be done relatively quick, maybe 10 minutes.

Note: You could have performed the --add sdc1 command after removing sda1, but doing it in the order listed above starts the recovery process more quickly.

  1. Once recovered, issue similar commands for md1

sudo mdadm --add /dev/md1 /dev/sdc2

sudo mdadm -f /dev/md1 /dev/sda2

sudo mdadm -r /dev/md1 /dev/sda2

This second partition is likely going to take much, much longer. For a ~4TB partition this took about 3 hours to complete. Your time will vary based on a number of factors.

  1. Once re-syncing has finished, you will want to repeat the same above listed steps for the second set of drives.

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

sudo mdadm -f /dev/md0 /dev/sdb1x

sudo mdadm -r /dev/md0 /dev/sdb1

(Wait for re-sync)

sudo mdadm --add /dev/md1 /dev/sdd2

sudo mdadm -f /dev/md1 /dev/sdb2

sudo mdadm -r /dev/md1 /dev/sdb2

(Wait for re-sync)

  1. At this point you can turn off the server and remove the old drives.

Afterthought: If you have e-mail notifications setup through mdadm, you will get a lot of notifications while performing this upgrade.

Share:
6,762

Related videos on Youtube

Sawta
Author by

Sawta

Updated on September 18, 2022

Comments

  • Sawta
    Sawta almost 2 years

    I currently have an FTP server that has approximately 500GB of space on it. I’m getting very close to reaching the limit of this (97%) and purchased two 4TB drives to replace the old drives. From what I can tell both of the disks in my RAID 1 array are fully synced and ready to go. I just can’t quite figure out what to do next.

    I’ve seen a few guides for adding new partitions, or adding new drives and starting from scratch (re-adding all of the data manually), but that isn't really what I want to do.

    I want to transfer the data on my old drives to the new drives. From what I have read, it almost seems like all I have to do is uninstall one of the old 500GB drives and install one of the 4TB drives and the 500GB one will automatically start syncing all of the information from the old one to the new one, then do the same with the second 500GB/4TB but that just seems way too easy. Surely there’s got to be a certain set of commands or something that have to be entered first, right?

    I wouldn’t be surprised if there is a guide for this available somewhere already, I’ve just been unable to find it and am a bit nervous to just start taking wild guesses at what to do next. Any advice or pushes in the right direction would be much appreciated!

    Additional notes: I’ve already formatted both of my new 4TB drives to run with my FTP Server and have tested for disk errors. They both came back clean and seem to be working fine. I just don't know where to go from here.