gmirror problem on 5.3-R i386

Christian Hiris 4711 at chello.at
Thu Jan 13 00:51:21 PST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 13 January 2005 03:54, Doug Poland wrote:
> Hello,
>
> I'm having a problem with gmirror.  It would seem that I cannot add my
> first disk to the mirror after booting off the second drive.  My current
> status is a degraded mirror and I cannot see any of the partitions on
> disk one.
>
> For a guide, I'm using the excellent instructions at:
> http://people.freebsd.org/~rse/mirror/
>
> My system has identical WD 80GB SATA drives (ad4 and ad6).  I've
> followed the steps in the document that are labeled:
>
>   "GEOM mirror Approach 2: Single Slice, Preferred, More Flexible"
>
> # dd if=/dev/zero of=/dev/ad6 bs=512 count=79
> # fdisk -v -B -I /dev/ad6
>
> # gmirror label -v -n -b round-robin gm0s1 /dev/ad6s1
> # gmirror load
>
> # bsdlabel -w -B /dev/mirror/gm0s1
> # bsdlabel -e /dev/mirror/gm0s1
>
> # newfs -U /dev/mirror/gm0s1a
> # mount /dev/mirror/gm0s1a /mnt
> # dump -L -0 -f- / | (cd /mnt; restore -r -v -f-)
> # newfs -U /dev/mirror/gm0s1d
> # mount /dev/mirror/gm0s1d /mnt/var
> # dump -L -0 -f- /var | (cd /mnt/var; restore -r -v -f-)
> # newfs -U /dev/mirror/gm0s1e
> # mount /dev/mirror/gm0s1e /mnt/tmp
> # dump -L -0 -f- /tmp | (cd /mnt/tmp; restore -r -v -f-)
> # mount /dev/mirror/gm0s1f /mnt/usr
> # dump -L -0 -f- /usr | (cd /mnt/usr; restore -r -v -f-)
> # cp -p /mnt/etc/fstab /mnt/etc/fstab.orig
>
> # sed -e 's/dev\/ad4s1/dev\/mirror\/gm0s1/g' </mnt/etc/fstab.orig
> # echo 'swapoff="YES"' >>/mnt/etc/rc.conf
> # echo 'geom_mirror_load="YES"' >>/mnt/boot/loader.conf
> # echo "1:ad(6,a)/boot/loader" >/boot.config
>
> # shutdown -r now
>
> # dd if=/dev/zero of=/dev/ad4 bs=512 count=79

You probably destroyed your slice table here. The dd command only makes sense 
if you insert whole disks (ie. /dev/ad4 and /dev/ad6) as providers. Otherwise 
you need to create (or already have) a valid slice table on the disk, which 
enables gmirror to locate and insert your slice. 

(!) Before you start to correct your gmirror setup, please read all of my 
comments, because to me it looks like you run a mirror of ad6 and not ad6s1.    
  
First you want to stop the mirror, you accidently started on ad4 (as seen in 
your 'gmirror list' output):
  # gmirror stop -v mirror

Then remove the gmirror metadata from ad4:  
  # gmirror remove -v mirror /dev/ad4

Clean out the first few sectors on ad4:
  # dd if=/dev/zero of=/dev/ad4 bs=512 count=79

Write out slice table where the only slice on te disk is ad4s1 (**:
  # fdisk -v -B -I /dev/ad4

After that go on with your procedure to add /dev/ad4s1 to mirror gm0s1: 

> # gmirror configure -a gm0s1

(**
Your 'gmirror list' output below looks like your mirror gm0s1 doesn't 
use /dev/ad6s1 as provider, it more likely uses /dev/ad6. So if this is the 
case, you may want to mirror the whole device (/dev/ad4), instead of the 
slice (/dev/ad4s1). Also, in this case don't use command 'fdisk -v -B 
- -I /dev/ad4', because MBR and slice table will be copied from ad6. 

[ # gmirror insert gm0s1 /dev/ad4  instead of /dev/ad4s1] 

> # gmirror insert gm0s1 /dev/ad4s1
>
>
> At this point I see...
>
>  "Unknown provider ad4s1"
>
> A gmirror list reveals:
>
> Geom name: mirror
> State: DEGRADED
> Components: 2
> Balance: load
> Slice: 2048
> Flags: NONE
> SyncID: 2
> ID: 4216140117
> Providers:
> 1. Name: mirror/mirror
                  ^^^^^^ 
>    Mediasize: 80026361344 (75G)
>    Sectorsize: 512
>    Mode: r0w0e0
> Consumers:
> 1. Name: ad4
           ^^^
This looks if you have entered a command like
'gmirror label -v -n -b load mirror /dev/ad4'?

>    Mediasize: 80026361856 (75G)
>    Sectorsize: 512
>    Mode: r0w0e0
>    State: ACTIVE
>    Priority: 0
>    Flags: NONE
>    SyncID: 2
>    ID: 3073402045
>
> Geom name: mirror.sync
>
> Geom name: gm0s1
> State: COMPLETE
> Components: 1
> Balance: round-robin
> Slice: 4096
> Flags: NONE
> SyncID: 1
> ID: 3205827760
> Providers:
> 1. Name: mirror/gm0s1
>    Mediasize: 80026329088 (75G)
>    Sectorsize: 512
>    Mode: r5w5e1
> Consumers:
> 1. Name: ad6
           ^^^
Same as above, this looks to me like you have entered a command like 'gmirror 
label -v -n -b round-robin gm0s1 /dev/ad6' instead of 'gmirror label -v -n -b 
round-robin gm0s1 /dev/ad6s1'? Maybe I'm wrong, or maybe there are some stale 
metadata on your disks?

>    Mediasize: 80026361856 (75G)
>    Sectorsize: 512
>    Mode: r5w5e2
>    State: ACTIVE
>    Priority: 0
>    Flags: DIRTY
>    SyncID: 1
>    ID: 1606771156
>
> geom name: gm0s1.sync

[...]

> webhost02# bsdlabel /dev/ad4
> bsdlabel: /dev/ad4: no valid label found

As I said above, your slice table has been zeroed by the dd command.

Cheers,
ch

- -- 
Christian Hiris <4711 at chello.at> | OpenPGP KeyID 0x3BCA53BE 
OpenPGP-Key at hkp://wwwkeys.eu.pgp.net and http://pgp.mit.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)

iD8DBQFB5jaF09WjGjvKU74RAiomAJ9GUllEIldi9DhlJK4IRWS1UUVVpwCaAzlW
rmlGRwE5C4QHkYb/AuGToqs=
=Kh0a
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list