# gmirror: How to activate a mirror after a disk failed?



## tingo (Jun 8, 2009)

Disks fail over time, that's just the way things are. In one of my servers I have two mirrors. A disk (ad4) failed on my machine,and suddenly one of the mirrors doesn't work:

```
root@kg-fil# uname -a
FreeBSD kg-fil.kg4.no 6.2-STABLE FreeBSD 6.2-STABLE #20: Mon Mar 12 23:04:49 CET 2007     root@kg-fil.kg4.no:/usr/obj/usr/src/sys/FIL60  amd64
```
I removed ad4, and thought that ad6 should still work

```
root@kg-fil# gmirror status
         Name    Status  Components
mirror/backup  COMPLETE  ad8
                         ad10
```
This is what a dumpe says:

```
root@kg-fil# gmirror dump ad6
Metadata on ad6:
     magic: GEOM::MIRROR
   version: 3
      name: storage
       mid: 1178038186
       did: 1420251553
       all: 2
     genid: 0
    syncid: 14
  priority: 1
     slice: 4096
   balance: split
 mediasize: 250058267648
sectorsize: 512
syncoffset: 0
    mflags: NONE
    dflags: SYNCHRONIZING
hcprovider:
  provsize: 250059350016
  MD5 hash: 8c76b66abfce70ce511c61ae6febef83
```
Ok, I'll try to activate it manually:

```
root@kg-fil# gmirror activate -v storage ad6
Provider ad6 activated.
Done.
```
It looks ok, but in /var/log/messages I see this: 


> Jun  1 23:03:04 kg-fil kernel: GEOM_MIRROR: Device storage created (id=1178038186).
> Jun  1 23:03:04 kg-fil kernel: GEOM_MIRROR: Device storage: provider ad6 detected.
> Jun  1 23:03:08 kg-fil kernel: GEOM_MIRROR: Force device storage start due to timeout.
> Jun  1 23:03:08 kg-fil kernel: GEOM_MIRROR: Device storage destroyed.


Why did GEOM destroy my mirror?
And how do I get it activated again?


----------



## bluetick (Jun 9, 2009)

Does "gmirror list" show all the drives?


"gmirror forget gm0"  to have it forget the bad drive.
"gmirror insert gm0 /dev/ad?" to add new drive.
It takes some time rebuild the mirror. 
"gmirror status" will list the drives and if it's complete.


----------



## tingo (Jun 10, 2009)

First of all, don't let the fact that this machine has two mirrors in it confuse your. The mirrors are "storage" (ad4 + ad6) and "backup" (ad8 + ad10). The "backup" mirror is working and complete.

For the "storage" mirror, drive ad4 has failed and has been removed (but nothing else has been done, except for restarting the machine.



			
				bluetick said:
			
		

> Does "gmirror list" show all the drives?{/quote]
> No, only the "backup" mirror shows up:
> 
> ```
> ...


Yes, but why doesn't the "storage" mirror show up as degraded?

```
root@kg-fil# gmirror status
         Name    Status  Components
mirror/backup  COMPLETE  ad8
                         ad10
```


----------



## bluetick (Jun 11, 2009)

I think this is what happened, ad4 was dead, then you used 'gmirror dump ad6' which destroyed the metadata on the only drive left in the storage mirror. Which is why you only see the backup mirror from the gmirror list command. The gmirror status you posted only shows the backup mirror, the storage mirror status is not in the return from gmirror status.

I don't know if you can restore the metadata on and recover the data from ad6 drive or not.


----------



## tingo (Jun 14, 2009)

@bluetick: thinking is good, but you should add some reading too. For example the man pages for 'gmirror'. 'gmirror dump' does not do what you think it does. It only dsplays info about providers, it does not change anything.

Again - one drive in the mirror (storage) is dead (ad4) and have een removed. The other drive (ad6) is still working.
Question: why can't I activate the mirror (even if it is degraded)?


----------



## tingo (Jun 30, 2009)

No hints on how to get the mirror working again? Do I really have to scrape the data off provider ad6?


----------

