Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can my md-RAID setup be grown safely?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Jarjar
Apprentice
Apprentice


Joined: 21 Jul 2002
Posts: 265
Location: Sweden

PostPosted: Wed Dec 07, 2011 7:41 pm    Post subject: Can my md-RAID setup be grown safely? Reply with quote

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.
_________________
[Server etc. | C2D 2.2 @ 3.0 GHz / 4 GB RAM / 3x1 TB + 1x2 TB SATA disks + 1.5 TB ext. | Gentoo]
[Laptop | Macbook Pro 15" / Core i7 (Sandy) Quad 2.2 GHz / 16 GB RAM / Samsung 840 250 GB SSD + 1 TB + 2 TB HDD / 6750M 1 GB / OS X, Win 7]
Back to top
View user's profile Send private message
wildbug
n00b
n00b


Joined: 07 Oct 2007
Posts: 73

PostPosted: Fri Dec 09, 2011 5:28 pm    Post subject: Reply with quote

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

Code:
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:
Code:
(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
Back to top
View user's profile Send private message
Jarjar
Apprentice
Apprentice


Joined: 21 Jul 2002
Posts: 265
Location: Sweden

PostPosted: Fri Dec 09, 2011 6:01 pm    Post subject: Reply with quote

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!).
_________________
[Server etc. | C2D 2.2 @ 3.0 GHz / 4 GB RAM / 3x1 TB + 1x2 TB SATA disks + 1.5 TB ext. | Gentoo]
[Laptop | Macbook Pro 15" / Core i7 (Sandy) Quad 2.2 GHz / 16 GB RAM / Samsung 840 250 GB SSD + 1 TB + 2 TB HDD / 6750M 1 GB / OS X, Win 7]
Back to top
View user's profile Send private message
drescherjm
Advocate
Advocate


Joined: 05 Jun 2004
Posts: 2790
Location: Pittsburgh, PA, USA

PostPosted: Sat Dec 10, 2011 5:37 pm    Post subject: Reply with quote

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

My gentoo overlay
Instructons for overlay
Back to top
View user's profile Send private message
Jarjar
Apprentice
Apprentice


Joined: 21 Jul 2002
Posts: 265
Location: Sweden

PostPosted: Sun Dec 11, 2011 5:59 pm    Post subject: Reply with quote

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).
_________________
[Server etc. | C2D 2.2 @ 3.0 GHz / 4 GB RAM / 3x1 TB + 1x2 TB SATA disks + 1.5 TB ext. | Gentoo]
[Laptop | Macbook Pro 15" / Core i7 (Sandy) Quad 2.2 GHz / 16 GB RAM / Samsung 840 250 GB SSD + 1 TB + 2 TB HDD / 6750M 1 GB / OS X, Win 7]
Back to top
View user's profile Send private message
Mad Merlin
Veteran
Veteran


Joined: 09 May 2005
Posts: 1155

PostPosted: Wed Dec 14, 2011 12:26 am    Post subject: Reply with quote

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.
_________________
Game! - Where the stick is mightier than the sword!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum