# Can my md-RAID setup be grown safely?

## Jarjar

I have a 3-disk RAID5 array managed by mdadm, with an XFS filesystem on top.

However, unlike many, I don't run LVM or such; I don't even have a partition table on the array, but rather a filesystem.

In other words, I didn't do:

mdadm --create ...

cfdisk /dev/md0

...

but rather did:

mdadm --create ...

mkfs.xfs /dev/md0

mount /dev/md0 /...

Can a setup like this be grown safely? I'd add a fourth partition (same size as the existing, of course), grow the array, then use xfs_growfs - AFAIK, that is.

----------

## wildbug

Yes, you should be able to do this by adding the new disk as a hot-spare, growing the array, then growing the filesystem.

```
mdadm /dev/md0 --add /dev/sde

mdadm --grow /dev/md0 -n4

...

xfs_growfs /your-xfs-mount-point

```

I just double-checked this in a VM, and the following was successful:

```
(Create the test array)

# mdadm --create /dev/md0 --level=5 -n3 /dev/sd[bcd]

# mkfs.xfs /dev/md0

# mount /dev/md0 /mnt

# df -h /mnt

Filesystem   Size  Used  Avail Use%  Mounted on

/dev/md0     394M  4.4M  390M  2%    /mnt 

(Add the new drive)

# mdadm /dev/md0 --add /dev/sde

# mdadm --grow /dev/md0 -n4

# xfs_growfs /mnt

# df -h /mnt

Filesystem   Size  Used  Avail Use%  Mounted on

/dev/md0     595M  4.6M  590M  1%    /mnt

```

----------

## Jarjar

Awesome, thanks for testing and everything! Amidst all the stress of yesterday's troubleshooting, I didn't even think about testing it in a VM (despite having a clone of that computer as a VM!).

----------

## drescherjm

I have grown mdadm arrays a dozen (mostly raid6) or so times at work without problems.

----------

## Jarjar

In case someone finds this by searching:

I just finished this process, and it worked great for me as well. Adding the disk took a long time (a bit over 20 hours), but xfs_growfs finished in 1.9 seconds!

Capacity increased as expected (by 50% despite going from 3->4 disks, a very nice side effect of RAID5).

----------

## Mad Merlin

FWIW, non-partitioned mdadm arrays are actually quite common. It's far more common to have /dev/md{0..n} than a single /dev/md0 with partitions inside it.

----------

