Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Resizing RAID1 on-the-fly?
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
Guayasil
n00b
n00b


Joined: 30 Nov 2006
Posts: 71

PostPosted: Fri Feb 28, 2014 12:43 pm    Post subject: Resizing RAID1 on-the-fly? Reply with quote

/dev/md8 is made of /dev/sda8 and /dev/sdb8 (equal in size), filesystem is ext3, mounted as /home

There is some free space left on sda and sdb and I can create /dev/sda9 and /dev/sdb9 (of the same size). My question is: can I resize md8 to occupy all available space (sda/b 8+9):
- extremely safely - with minimized risk of data loss ?
- on-the fly - without the need of reboot and even without longer unavailability of /home ?

Thanks for any help
Back to top
View user's profile Send private message
drescherjm
Advocate
Advocate


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

PostPosted: Fri Feb 28, 2014 5:02 pm    Post subject: Reply with quote

I think you can do this by failing 1 device from the raid1 then remove it from the raid (must do that or the partition table can not be changed). Then repartition the removed disk and add the device back to the array. It will rebuild then fail the second remove it repartition and add it back to the array. After this grow the array.

However with all that said you still may get into trouble if any other arrays are using the other partitions of these disks.
_________________
John

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


Joined: 22 Nov 2007
Posts: 19
Location: Voronezh

PostPosted: Sat Mar 01, 2014 1:33 pm    Post subject: Reply with quote

If you try to create additional partitions while system is running, kernel will refuse reload of partition table, because that drives are exclusively used for RAID. So on-disk partition table (MBR or GPT) will be updated, but /dev/sda9 and /dev/sdb9 will not appear until reboot.

0. Before doing anything it is of paramount importance to be sure your array and drives are in good shape. Consider looking S.M.A.R.T info and recheck all their arrays:
echo "check" > /sys/block/md8/md/sync_action
Wait until check is complete:
watch cat /proc/mdstat
Don't continue until you are sure everything is ok!

To extend array online (with zero downtime), follow drescherjm instructions. I will write them down more detailed:
1. Expel one disk from array (if it has other partitions participating in other arrays, you will need to remove it from these too. Or system will not reload table. To do that you need mark disk as failed and then remove:
mdadm -f /dev/md8 /dev/sda8
mdadm -r /dev/md8 /dev/sda8

2. Repartition this drive
fdisk /dev/sda
remove and then create bigger sda8.

3. Add it back to array
mdadm --add /dev/md8 /dev/sda8\
of course, other arrays need to be re-added as well

4. Wait for array to reconstruct. To see action, use
watch cat /proc/mdstat
Ctrl+C when it shows that array is synched.

5. Repeat same with other drive:
mdadm -f /dev/md8 /dev/sdb8
mdadm -r /dev/md8 /dev/sdb8
fdisk /dev/sdb
mdadm --add /dev/md8 /dev/sdb8
and wait until reconstruct.

6. Now, you can simply grow array:
mdadm --grow /dev/md8

This will expand your array to use maximum available size.

Now you can expand anything is on this array: filesystem (resize2fs), lvm physical (pvresize) or what else you have there.

Last thing I want to point out, you will have no failure protection until everything is done. That's why you need to be sure your drives are ok and not having any fatigue which will unexpectedly expose at some important moment, having you lose hair. And better use good UPS.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43184
Location: 56N 3W

PostPosted: Sat Mar 01, 2014 2:26 pm    Post subject: Reply with quote

nilreM,

The resync is not required as all this process does is to change the partition table under the raid without moving its start.
No user data is harmed by this process.

Does mdadm --grow /dev/md8 grow the filesystem is finds on /dev/md8 too?
I suspect not, so you also need to invoke the filesystem resize utility after the raid has been resized. For extX Thats resize2fs
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
drescherjm
Advocate
Advocate


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

PostPosted: Sat Mar 01, 2014 9:20 pm    Post subject: Reply with quote

Quote:
I suspect not, so you also need to invoke the filesystem resize utility after the raid has been resized. For extX Thats resize2fs


I am pretty sure it does not grow the filesystem. I say pretty sure because almost every time I have done this I had lvm on top of mdadm raid5 or raid6. These days I am migrating everything (90TB+ on gentoo servers) to btrfs and now zfs and see much less lvm usage.
_________________
John

My gentoo overlay
Instructons for overlay
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