correct way to setup gmirror on 7.4?

Michael Proto mike at jellydonut.org
Wed Apr 27 22:44:42 UTC 2011


On Wed, Apr 27, 2011 at 6:30 PM, Freddie Cash <fjwcash at gmail.com> wrote:
> On Wed, Apr 27, 2011 at 3:15 PM, Clifton Royston <cliftonr at lava.net> wrote:
>>  I don't know; it looks correct to me, but I may be missing something
>> as I don't currently use gpart.
>
> gmirror (well, really, any GEOM) doesn't play well with GPT due to the
> way they store their metadata.
>
> gmirror doesn't touch the start of the disk, but saves it's metadata
> in the last sector of the disk, and creates a new GEOM provider that's
> one sector shorter.
>
> GPT stores it's partition table in the first sector of the disk, and
> saves a backup copy of it in the last sector of the disk.
>
> Depending on the order you do things, gmirror can overwrite the
> secondary GPT table.  Or, if you mirror the disk and then gpart the
> mirror, gpt will complain that the secondary table is not in the last
> sector of the disk (due to the order that GEOM tastes things as gpt
> goes first).
>
> I've tried to document it here.  Let me know if there's anything incorrect.
> https://forums.freebsd.org/showthread.php?t=22125
>

What I ultimately decided to do was use fdisk in interactive mode to
manually align 2 4k-boundary MBR partitions, /dev/ad4s1 and
/dev/ad4s2, created 2 gmirrors out of them, then bsdlabel-ed and
newfs-ed the mirror devices.

socrates:mike/ $ fdisk /dev/ad4
******* Working on device /dev/ad4 *******
parameters extracted from in-core disklabel are:
cylinders=1938021 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=1938021 heads=16 sectors/track=63 (1008 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 2048, size 195330048 (95376 Meg), flag 80 (active)
        beg: cyl 2/ head 0/ sector 33;
        end: cyl 245/ head 13/ sector 29
The data for partition 2 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 195338240, size 1758167040 (858480 Meg), flag 0
        beg: cyl 251/ head 14/ sector 63;
        end: cyl 593/ head 4/ sector 20
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

(note the "start 2048" and "start 195338240" for the partitions above,
which are 4k-aligned)

gmirror label -v -n -b round-robin gm0s1 /dev/ad4s1
gmirror configure -a gm0s1
gmirror label -v -n -b round-robin gm0s2 /dev/ad4s2
gmirror configure -a gm0s2

bsdlabel -w /dev/mirror/gm0s1
bsdlabel -w /dev/mirror/gm0s2

newfs -U -b 32768 -f 4096 -S 4096 /dev/mirror/gm0s1a
newfs -U -b 32768 -f 4096 -S 4096 /dev/mirror/gm0s2a


I believe this will work since there's no last-block used for MBR
partitions, only GPT. gmirror should happily have its metadata in the
last block and partitions shouldn't complain.

I'm copying data to the arrays now and will insert my /dev/ad6
partitions after that. I'll reboot once more to confirm no strangeness
(apart from GEOM complaining about my sector boundaries due to these
4k-reporting-as-512b disks).

Thanks everyone for the suggestions and support, it is very much
appreciated here!!


-Proto


More information about the freebsd-stable mailing list