Increase Disk Size in a gmirror RAID1

Charles Uchu Strader uchu.1 at gaiahost.coop
Sun Aug 26 15:00:36 PDT 2007


So it looks like I came up with a resolution myself on this.  Here's a 
post for posterity or any comments:
>
>
> What I've done so far is to forget da1 from the gm0 mirror, restart, 
> and put the 73GB into drive bay two.  But now I'm at bit lost at the 
> process to follow to achieve my desired result.  I'm thinking 
> something like fdisk, bsdlabel, newfs on the new da1 73GB drive.  Then 
> dd or dump/restore from da0/gm0 to da1.  Then shutdown, remove the 
> 36GB da0, put in the second 73GB drive, boot and them get gmirror to 
> sync things from the 73GB drive.
>

So my resolution to upsizing the disk was to utilize gmirror (rather 
than dump/restore or dd).  Here's what I did:

1) Sync the existing smaller disk (da0 / 36GB) to the new larger disk 
(da1 / 73GB) now in the machine using gmirror.

2) Remove da0 from the gmirror:

# gmirror remove gm0 da0

3) Edit /etc/fstab so that after the next reboot it will boot as if only 
a single disk, instead of the gmirror /dev/mirror .  Also comment out: 
geom_mirror_load="YES" in /boot/loader.conf

4) Shutdown and power down.  Take out 36GB from drive bay 1.  Take 73GB 
from drive bay 2 and put into drive bay 1.  Start the server back up and 
da0 is now the 73GB drive.

5) Now, since gmirror applied its slice and disklabel partition, 
checking disk usage shows that the system sees the disk still as a 36GB 
and the /web partition I wanted to increase was still at 18GB, instead 
of the 51GB I needed.  To fix that I did the following:

# fdisk -u /dev/da0  (just following the standard prompts, only needing 
to change the total byte size from from 71119692 (36GB) to 143363997 
(73GB) when that prompt came up)

# disklabel -e /dev/da0s1  (updated the disk labels so that c: had the 
new 143363997 value and so that g: (the /web partition) had the new 
value 110491549.

# umount /web

# newfs  -U /dev/da0s1g

# mount /dev/da0s1g /web

6) Edit the /etc/fstab to restore it to the gmirror style references, 
instead of single disk.  And uncomment out: : geom_mirror_load="YES" in 
/boot/loader.conf

Then also:

# gmirror label -v -b round-robin gm0 /dev/da0

7) Shutdown and power down.  Add the second new 73GB drive into bay 2.  
Restart the server and once booted back in get both bigger drives in 
sync with gmirror and everything is good to go!

# gmirror insert gm0 da1

...

(Caveat)  I've only done this on a test machine with no activity and no 
data in the /web partition.  Before I do this on a live server, I'll 
probably run the whole process again with data in /web and see how it 
all does.

Any comments or thoughts about this process, would love feedback. 

~Charles Uchu


More information about the freebsd-questions mailing list