Can you add a hard drive to a RAID?

10,062

Solution 1

I have a server using md for a software RAID5, which I have grown multiple times in the past.

It's a pretty simple process.

First, we add our new device to the raid array. /dev/sdX is the device you want to add to the RAID group.

sudo mdadm /dev/md0 --add /dev/sdX

And now we resize the array. N should be the number of devices in the group (including the new one).

sudo mdadm /dev/md0 --grow --raid-devices=N

After that the lengthy rebuild process will start moving around data. Observe the process by using:

watch cat /proc/mdstat

When that is done, you'll have a larger RAID volume with all your data intact.

Solution 2

  1. If you are using raidz or raidz2, you cannot add more drives to that particular set once you create it.

  2. You can, however, create another raidz or raidz2 and add it to that pool.

  3. Remember though, with two drives you can only mirror.

Take a look at this

Share:
10,062

Related videos on Youtube

n0pe
Author by

n0pe

Updated on September 18, 2022

Comments

  • n0pe
    n0pe over 1 year

    I've decided on creating a NAS running FreeNAS using a software RAID 5 setup. I want to start the RAID with 2x2TB drives and slowly add more 2TB drives as I go. Is this possible? If I have a full RAID 5, can I add another drive to it without erasing the previous drives?

    • hookenz
      hookenz about 12 years
      You need a minimum of 3 disks for raid 5 to start with.
    • retracile
      retracile about 12 years
      I haven't tried it recently, but Linux software RAID5 was able to create a 2-disk RAID5, and worked fine, including degraded operation and rebuild. Think of a two-disk RAID5 as a computationally expensive RAID1. But it does buy you the ability to add disks later.
    • hookenz
      hookenz about 12 years
      @retractile - interesting. Thought I'd look that up and sure enough it's true. With 2 disks it acts like a mirror. arkf.net/blog/?p=47
  • thomas
    thomas about 12 years
    OK, you will still need more than two drives though. If you are using a RAID card supported by freeNAS, and it has the ability to access the controller card via a webGUI, you can theoretically access the card and expand the RAID. In my experience though, freeNAS plays better with standard HBA's. One of the great benefits of freeNAS though is the ability to implement zfs using raidz or raidz2.