Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2011 19:35:22 +0000 (UTC)
From:      "Helmut Schneider" <jumper99@gmx.de>
To:        freebsd-stable@freebsd.org
Subject:   Re: correct way to setup gmirror on 7.4?
Message-ID:  <xn0hddht75xo97q00a@news.gmane.org>
References:  <BANLkTimCFcw_Oyp9RmBhfCZ9-QORUQEwfA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Michael Proto wrote:

> I'm migrating away from my old pseudo-RAID partitions to GEOM gmirror
> and I have some questions on the right way to accomplish this. I've
> got two new 1TB disks that I'm setting up for the new mirror, and
> unfortunately they're Western Digital drives with 4k sectors that
> report themselves as 512b.
> 
> Here's what I'm currently doing to setup this array. The disks are
> detected as ad4 and ad6 on my FreeBSD 7.4 server.
> 
> # initialize/wipe MBR
> dd if=/dev/zero of=/dev/ad4 bs=512 count=79
> dd if=/dev/zero of=/dev/ad6 bs=512 count=79
> # gpart
> gpart create -s gpt ad4
> gpart create -s gpt ad6
> gpart bootcode -b /boot/pmbr ad4
> gpart bootcode -b /boot/pmbr ad6
> # add partitions
> gpart add -t freebsd-ufs -l raidhome1-2 -b 2048 -s 195330048 ad4
> gpart add -t freebsd-ufs -l raidhome2-2 -b 2048 -s 195330048 ad6
> gpart add -t freebsd-ufs -l raidvault1-2 -b 195338240 -s 1758167040
> ad4 gpart add -t freebsd-ufs -l raidvault2-2 -b 195338240 -s
> 1758167040 ad6
> 
> (I'm using these partition start values because they divide evenly
> into 4k blocks. I don't mind wasting a few MB on each disk to have
> correctly-aligned partitions)
> 
> gpart show ad4
> =>        34  1953525101  ad4  GPT  (932G)
>           34        2014       - free -  (1.0M)
>         2048   195330048    1  freebsd-ufs  (93G)
>    195332096        6144       - free -  (3.0M)
>    195338240  1758167040    2  freebsd-ufs  (838G)
>   1953505280       19855       - free -  (9.7M)
> 
> gpart show ad6
> =>        34  1953525101  ad6  GPT  (932G)
>           34        2014       - free -  (1.0M)
>         2048   195330048    1  freebsd-ufs  (93G)
>    195332096        6144       - free -  (3.0M)
>    195338240  1758167040    2  freebsd-ufs  (838G)
>   1953505280       19855       - free -  (9.7M)
> 
> gmirror label -v -n -b round-robin gm0p1 /dev/ad4p1
> newfs -U -b 32768 -f 4096 -S 4096 /dev/mirror/gm0p1
> 
> gmirror label -v -n -b round-robin gm0p2 /dev/ad4p2
> newfs -U -b 32768 -f 4096 -S 4096 /dev/mirror/gm0p2
> 
> (then I mount /dev/mirror/gm0p1 and /dev/mirror/gm0p2 and copy data
> from my original array to this new array)
> 
> Finally I insert the ad6 disk and wait for the array to sync:
> 
> gmirror configure -a gm0p1
> gmirror insert gm0p1 /dev/ad6p1
> 
> gmirror configure -a gm0p2
> gmirror insert gm0p2 /dev/ad6p2
> 
> 
> Once the array is synchronized things generally look good, although
> after a reboot I did see the following that had me concerned (from
> dmesg output):
> 
> GEOM: ad4: the primary GPT table is corrupt or invalid.
> GEOM: ad4: using the secondary instead -- recovery strongly advised.
> 
> Am I using the correct process to create this array?

No. While this works with MBR it fails with GPT as GPT and GEOM both
want to use the last sector of the disk.

First create the mirror and after that gpart it. It will create a
message like

GEOM: da0: the secondary GPT header is not in the last LBA.
GEOM: da1: the secondary GPT header is not in the last LBA.

which afaik is ignorable. At least it works fine here and I didn't find
any caveats in the net.

Another workaround is not to mirror the disk but only slices or
partitions.

HTH, Helmut




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