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

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:
Code:
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
Code:
root@kg-fil# gmirror status
         Name    Status  Components
mirror/backup  COMPLETE  ad8
                         ad10
This is what a dumpe says:
Code:
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:
Code:
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?
 
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.
 
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:
Code:
root@kg-fil# gmirror list
Geom name: backup
State: COMPLETE
Components: 2
Balance: split
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 2160496819
Providers:
1. Name: mirror/backup
   Mediasize: 250059349504 (233G)
   Sectorsize: 512
   Mode: r1w1e1
Consumers:
1. Name: ad8
   Mediasize: 250059350016 (233G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: DIRTY
   GenID: 0
   SyncID: 1
   ID: 2641044883
2. Name: ad10
   Mediasize: 250059350016 (233G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 1
   Flags: DIRTY
   GenID: 0
   SyncID: 1
   ID: 1522717611

"gmirror status" will list the drives and if it's complete.
Yes, but why doesn't the "storage" mirror show up as degraded?
Code:
root@kg-fil# gmirror status
         Name    Status  Components
mirror/backup  COMPLETE  ad8
                         ad10
 
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.
 
@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)?
 
No hints on how to get the mirror working again? Do I really have to scrape the data off provider ad6?
 
Back
Top