Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Aug 2008 23:39:46 -0400 (EDT)
From:      John R Levine <johnl@taugh.com>
To:        freebsd-doc@freebsd.org
Subject:   Update to section 19.4 on disk mirroring
Message-ID:  <alpine.BSF.1.10.0808252313150.13542@simone.iecc.com>

next in thread | raw e-mail | index | archive | help
I just added an extra disk to a BSD server to mirror the existing one, and 
looked at section 19.4 on GEOM mirroring.  While the advice it gives on 
setting up bootable gmirror disks isn't wrong, it's seriously suboptimal 
since it involves a needless full copy of a disk, which takes hours rather 
than five minutes if you do it the easy way.

I dunno what the etiquette is for updating the handbook, but I'd be happy 
to redo this part to say, roughly:

It's straightforward to convert any bootable FreeBSD disk to a gmirror 
mirror if you have a second disk of the same size.  Call the existing disk 
ad0 and the new second disk ad2.

First, use fdisk to set the slices on the second disk identically to the 
first disk, using fdisk -p to dump the slice config of ad0 and fdisk -f to 
apply that config to ad2.  Put geom_mirror_load="YES" into 
/boot/loader.conf to ensure that gmirror is loaded at boot time, or build 
and install a new kernel with options GEOM_MIRROR.

You can't do GEOM work when any of the file systems are mounted, so 
reboot from a live FS CD.  Create the mirror, initially with the single 
existing disk:

  # gmirror label -v gm0 ad0

You should see a kernel message confirming the creation of the mirror, and 
a listing /dev/mirror should show an entry corresponding to each partition 
on the disk, e.g., for /dev/ad0s1a now there's /dev/mirror/gm0s1a

You need to change fstab to refer to the mirrored file systems.  Mount 
your root fs on /mnt so you can edit it:

  # mount /dev/mirror/gm0s1a /mnt

Edit /mnt/etc/fstab, changing each entry including the swap file 
appropriately, e.g. /dev/ad0s1a to /dev/mirror/gm0s1a.

Unmount /mnt, reboot from the disk.  It should come up and mount all the 
/dev/mirror file systems, running as before except for the filesytem 
names.

Now add the new second disk to the mirror:

  # gmirror insert gm0 ad2

Use gmirror status to see it copying the data from ad0 to ad2 in in the 
background.  You can use your system while it does this.

Regards,
John Levine, johnl@taugh.com, Taughannock Networks, Trumansburg NY
"I dropped the toothpaste", said Tom, crestfallenly.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.1.10.0808252313150.13542>