# gmirror testing/recovery



## babel17 (Oct 14, 2009)

I'm trying to set up a reasonably robust dual disk gmirror on FreeBSD 8.0 RC1 amd64, following http://onlamp.com/pub/a/bsd/2005/11/10/FreeBSD_Basics.html

The only difference is that I'm using "prefer" as opposed to "round-robin", on the assumption that I need this in order to be sure any crash dumps are written to /dev/ad4s1b

Here's my problem:
In order to test the robustness of the system, I do an 'ls -lR /' and yank the active drive (they are in hotswap bays).  It spews out some error messages and then continues.  I then shut the system down, plug the drive back in, and reboot.

I get the expected errors:


```
GEOM_MIRROR: Component ad4 (device gmtest) broken, skipping.
GEOM_MIRROR: Device mirror/gmtest launched (1/2).
```

no big deal.

OK, how to recover?
I would have though that I should be able to use 'gmirror recover gmtest ad4' to get this drive back, but apparently it doesn't work that way.  Most operations, 'recover', 'deactivate', 'insert', 'forget' etc. all respond with 

```
gmirror: No such provider: ad4.
```

'clear' appears to work in that it doesn't return an error message, but even after issuing I cannot re-insert the drive.

```
badtrip# gmirror forget ad4
gmirror: No such device: ad4.
badtrip# gmirror clear ad4
badtrip# gmirror insert -v gmtest ad4
gmirror: Not all disks connected.
```
This last error message really bothers me since I can see that /dev/ad4 *is* there.  I can fsck it and mount it. Well ad4s1a anyway.

The only thing that really works is to use 

```
dd if=/dev/zero of=/dev/ad4 oseek=<last_sector_address>
```
and then 'insert'.  This is an awkward and time consuming procedure. Am I missing something?  

On a possibly unrelated note, what is the advantage/disadvantage of hard coding the provider in the metadata?


----------



## aragon (Oct 15, 2009)

For the forget command, you need to specify the gmirror device name, not the provider name.  Try this:


```
gmirror forget gmtest
```

And then try reinsert the provider.


----------



## babel17 (Oct 15, 2009)

Doh! -1 me


----------

