# Error setting up gmirror 'gmirror clear'



## smallacj (Feb 15, 2010)

After using gmirror on a 7.2-STABLE server for 6 months, a hardware failure followed by a corrupted file system (wouldn't boot cleanly) required that I bring up a new server and copy over some of the file systems to the new server. I use only one slice, but with the following BSD partitions:

/ (incl /usr) clean install 7.2-RELEASE
/usr/local copied from one of the old mirror disks
/var clean install with some files and dirs copied over
/tmp  clean
/home (customer data) copied from old disk

Once getting this up and running (production server) on /dev/ad0, I then followed the excellent instructions on the wiki here:

http://www.freebsdwiki.net/index.php/RAID1,_Software,_How_to_setup

in single user mode to set up mirroring on /dev/ad0 and /dev/ad2.  One of the old disks is still on /dev/ad3 in case we need any old files we might have missed.

The only glitch that I ran into following the instructions was when I tried to clear out the old gmirror meta data doing a "gmirror clear" as prescribed.  I was in a hurry to get the server back up, so I unfortunately don't have the exact error, but it basically was telling me the argument was not valid, even though the dev names were correct and worked for every other step.

The server is up and running fine with it's mirror and the third, old disk as you would expect:


```
/dev/mirror/gm0s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/mirror/gm0s1g on /home (ufs, local, soft-updates)
/dev/mirror/gm0s1d on /tmp (ufs, local, soft-updates)
/dev/mirror/gm0s1e on /usr/local (ufs, local, soft-updates)
/dev/mirror/gm0s1f on /var (ufs, local, soft-updates)
/dev/ad3s1a on /mnt/OLD (ufs, local)
/dev/ad3s1d on /mnt/OLD/tmp (ufs, local, soft-updates)
/dev/ad3s1e on /mnt/OLD/usr/local (ufs, local, soft-updates)
/dev/ad3s1f on /mnt/OLD/var (ufs, local, soft-updates)
/dev/ad3s1g on /mnt/OLD/home (ufs, local, soft-updates)
devfs on /var/named/dev (devfs, local)
```

However, I am concerned about old meta data causing problems.  The wiki states:

Make ABSOLUTELY CERTAIN that you don't have any pre-existing GEOM module labels written to either of your drives - because if you do (for instance from having futzed about with this before finding this article, or trying the article once and then trying it again) it will prevent other things from working. So, clean off any preexisting metadata from each drive:


```
# gmirror clear /dev/ad0
# gmirror clear /dev/ad2
```

As I noted, the above produced an error (that I can't recall, unfortunately) with both devices.

On boot, I got the following:


```
+ad0: 476940MB <WDC WD5000AAKS-00D2B0 12.01C02> at ata0-master SATA150
+GEOM_MIRROR: Device mirror/gm0 launched (1/1).
+acd0: DVDR <HL-DT-STDVD-RAM GH22LS30/1.02> at ata0-slave SATA150
+ad2: 476940MB <WDC WD5000AAKS-00D2B0 12.01C02> at ata1-master SATA150
+ad3: 476940MB <WDC WD5000AAKS-00A7B2 01.03B01> at ata1-slave SATA150
+SMP: AP CPU #1 Launched!
+GEOM_LABEL: Label for provider acd0 is iso9660/FreeBSD_Install.
+GEOM_LABEL: Label for provider mirror/gm0s1a is ufsid/4b70da022dd1047b.
+GEOM_LABEL: Label for provider mirror/gm0s1d is ufsid/4b70da0d55f96d5b.
+GEOM_LABEL: Label for provider mirror/gm0s1e is ufsid/4b70da0e19c93161.
+GEOM_LABEL: Label for provider mirror/gm0s1f is ufsid/4b70da0e20e9242f.
+GEOM_LABEL: Label for provider mirror/gm0s1g is ufsid/4b70da02f80cbfe5.
+GEOM_MIRROR: Device gm0 already configured.
+GEOM_LABEL: Label for provider ad3s1a is ufsid/4a3ae4de0a56c8cb.
+GEOM_LABEL: Label for provider ad3s1d is ufsid/4a3ae4eb9b4cf2fe.
+GEOM_LABEL: Label for provider ad3s1e is ufsid/4a3ae4ec717e3bed.
+GEOM_LABEL: Label for provider ad3s1f is ufsid/4a3ae4ec312ebf3b.
+GEOM_LABEL: Label for provider ad3s1g is ufsid/4a3ae4dfa451f7f0.
+Trying to mount root from ufs:/dev/mirror/gm0s1a
+GEOM_LABEL: Label ufsid/4b70da022dd1047b removed.
+GEOM_LABEL: Label for provider mirror/gm0s1a is ufsid/4b70da022dd1047b.
+GEOM_LABEL: Label ufsid/4b70da02f80cbfe5 removed.
+GEOM_LABEL: Label ufsid/4a3ae4de0a56c8cb removed.
+GEOM_LABEL: Label for provider mirror/gm0s1g is ufsid/4b70da02f80cbfe5.
+GEOM_MIRROR: Device gm0 already configured.
+GEOM_LABEL: Label for provider ad3s1a is ufsid/4a3ae4de0a56c8cb.
+GEOM_LABEL: Label ufsid/4b70da0d55f96d5b removed.
+GEOM_LABEL: Label for provider mirror/gm0s1d is ufsid/4b70da0d55f96d5b.
+GEOM_LABEL: Label ufsid/4a3ae4eb9b4cf2fe removed.
+GEOM_MIRROR: Device gm0 already configured.
+GEOM_LABEL: Label for provider ad3s1d is ufsid/4a3ae4eb9b4cf2fe.
+GEOM_LABEL: Label ufsid/4b70da0e19c93161 removed.
+GEOM_LABEL: Label for provider mirror/gm0s1e is ufsid/4b70da0e19c93161.
+GEOM_LABEL: Label ufsid/4a3ae4ec717e3bed removed.
+GEOM_MIRROR: Device gm0 already configured.
+GEOM_LABEL: Label for provider ad3s1e is ufsid/4a3ae4ec717e3bed.
+GEOM_LABEL: Label ufsid/4b70da0e20e9242f removed.
+GEOM_LABEL: Label for provider mirror/gm0s1f is ufsid/4b70da0e20e9242f.
+GEOM_LABEL: Label ufsid/4a3ae4ec312ebf3b removed.
+GEOM_MIRROR: Device gm0 already configured.
+GEOM_LABEL: Label for provider ad3s1f is ufsid/4a3ae4ec312ebf3b.
+GEOM_LABEL: Label ufsid/4a3ae4dfa451f7f0 removed.
+GEOM_MIRROR: Device gm0 already configured.
+GEOM_LABEL: Label for provider ad3s1g is ufsid/4a3ae4dfa451f7f0.
+GEOM_LABEL: Label ufsid/4b70da022dd1047b removed.
+GEOM_LABEL: Label ufsid/4b70da02f80cbfe5 removed.
+GEOM_LABEL: Label ufsid/4b70da0d55f96d5b removed.
+GEOM_LABEL: Label ufsid/4b70da0e19c93161 removed.
+GEOM_MIRROR: Device gm0: rebuilding provider ad2.
+GEOM_MIRROR: Device gm0: rebuilding provider ad2 finished.
```


How concerned to I have to be?  I'm not worried about any meta data on /dev/ad3, but if I have to, is there a way to clear the old meta data out of the mirrored devices without taking it down to single user mode again?

Thanks!


----------

