Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Apr 2011 17:32:03 +0100
From:      Pete French <petefrench@ingresso.co.uk>
To:        petefrench@ingresso.co.uk, tevans.uk@googlemail.com
Cc:        freebsd-stable@freebsd.org
Subject:   Re: correct way to setup gmirror on 7.4?
Message-ID:  <E1QFU8J-000JnI-42@dilbert.ingresso.co.uk>
In-Reply-To: <BANLkTi=1_aaZ6LVv632kWKXr14eDtFYA8Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> Is this simple to do? When I setup my home ZFS server, I couldn't get
> it to boot from ZFS, so I configured 2 disks as 'boot' discs:

Its fairly simple - I generally dont boot from ZFs either, my
standard config has a 4 gig UFS boot partition, and then a large zpool
on the rest of the drive. usually I add in a bit of swap there, which I
dnt mirror, so I get swap on each drive.

So each disk looks like this with MBR

da0s1 - 4 gig for /
da0s2 - 2 gig for swap
da0s3 - rest of drive for zpool

because the gmirror is at the end of the partiton then the boot
code finds the UFS filesystem at the start and boots from it not
needing to know about gmirror. The gmirror is loaded in the boot
process, and then mirrors the drive being booted with the other drive.
I can boot of either drive and the system comes up fine.  As for the
zpool, well that sorts itself out fne, as ZFS is wont to do ;-)

> =>        34  2930277101  ada5  GPT  (1.4T)
>           34         128     1  (null)  (64K)
>          162    12582912     2  root  (6.0G)
>     12583074  2917694061     3  samsung15-1  (1.4T)
>
> The other 'boot' disc is configured the same, except it has
> altroot/samsung15-2 labels on the UFS/ZFS GPT partitions (the other 4
> discs have a corresponding 6 GB partition for swap/dumps).
>
> However, this is as far as I got. I currently have
> vfs.root.mountfrom="ufs:/dev/gpt/root", and I'd like to gmirror 'root'
> onto 'altroot', without overwriting GPT labels or anything dangerous!

I havent tried with GPT, but it should be the same as with MBR.
Boot off the 1st drive, create a gmirror inside the root partition on
the 2nd drive, newfs it and then cpdup the running system over to it.
Make sure you do the necessaries on the 2nd drive to make it bootable
as if you just had a standard UFS filesystem in that partition, with no
gmirror. Now on te 2nd drive edit loader.conf so it looks something
like this:

    geom_mirror_load="YES"
    vfs.root.mountfrom="ufs:/dev/mirror/mymirror"

and fstab similarly:

    /dev/mirror/mymirror         /               ufs     rw      2       2

Yu shuld now be able to boot from the 2nd drive fine. Check that
works - it should come up OK, running wth your root on agmirror
with a single element on that partition. At this point you can then
add in the partition from the first disc to the mirror. Should now
boot from either drive fine.

as I said, I havent tried it with GPT, but there is no reason I can see
that it wudnt work the same as with MBR. The only reason I still stick
with MBR is that I like the FreeBSD boot loader which will
let me choose F5 to select the next drive to boot from. Last time I
looked there wasn't an exquivalent for GPT (if I missed this then I
will now feel foolish...)

cheers,

-pete.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1QFU8J-000JnI-42>