# Reclaiming a drive from a gmirror array



## pmorrill (Nov 5, 2010)

I use gmirror RAID1 to both assure data redundancy and to create hard-drives for swapping into production servers when major upgrades are needed. But I am struggling with something that should be easy:

If I remove a drive from gmirror, should I then be able mount it as a standalone drive on that or another machine? Specifically, my full drives are mirrored, including O/S and boot section, but I'd like to take one OLD drive out, mount its data partitions standalone, then recover data off it on another temporary machine (running its own o/s of course)

I have tried to do this, but am only able to mount the SLICE (eg: ad6s1), not the individual partitions (eg: ad6s1f). I am thinking that this is because there are no labels on the patitions (verified using bsdlabel)? Gmirror plants its info on the final sectors, but why is the original labelling gone? It was there when I installed the original 0/S....

It seems to me that having a RAID 1 from which I cannot grab a single drive and mount independently for data recovery is less than ideal. I am not an expert system admin though, so any suggestions would be very helpful. What am I doing wrong?

OS is FBSD 7.3-RELEASE-p2
Drives are SATA


----------



## phoenix (Nov 5, 2010)

How did you configure gmirror?  Using the block device?  Using the slice?  Using individual partitions?

How did you slice/partition things?  Using the block device?  Using the gmirror device?

The output of `$ gmirror status` and `$ gmirror list` would be helpful.

Finally, on the "temp" box, did you try running `# gmirror start` to load the geom_mirror module and read the gmirror metadata on the drive?  And then access the drive using the gmirror name?


----------



## pmorrill (Nov 6, 2010)

The production server was first built as per Handbook section 2.6 - Allocating Disk Space. Immediately afterwards (before installing ports/packages) I followed the procedure in section 19.4.1 - Mirroring Primary disks.

On the production server:


```
# cat /etc/fstab
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/mirror/gm0s1b      none            swap    sw              0       0
/dev/mirror/gm0s1a      /               ufs     rw              1       1
/dev/mirror/gm0s1g      /files          ufs     rw              2       2
/dev/mirror/gm0s1e      /tmp            ufs     rw              2       2
/dev/mirror/gm0s1f      /usr            ufs     rw              2       2
/dev/mirror/gm0s1d      /var            ufs     rw              2       2
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0

# gmirror list:
Geom name: gm0
State: COMPLETE
Components: 2
Balance: round-robin
Slice: 4096
Flags: NOAUTOSYNC
GenID: 6
SyncID: 2
ID: 422400512
Providers:
1. Name: mirror/gm0
   Mediasize: 500107861504 (466G)
   Sectorsize: 512
   Mode: r6w6e7
Consumers:
1. Name: ad4
   Mediasize: 500107862016 (466G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: NONE
   GenID: 6
   SyncID: 2
   ID: 607160297
2. Name: ad6
   Mediasize: 500107862016 (466G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: NONE
   GenID: 6
   SyncID: 2
   ID: 2364277607
```
I tried removing ad6 from this array, and then mounting it as standalone on a 'temp' server, which is itself also running a gmirrored primary drive, but with only one provider. So: there are now 2 drives on the 'temp' box: the 'mirrored' primary and the ad6 drive from the production box.

On the 'temp' box, the hope is to mount ad6s1g as /tmp/old/files and diff it against similar directory on the primary drive. This mount command failed ('no such device /dev/ad6s1g'):

`# mount /dev/ad6s1g /tmp/old/files`

But this one worked (though not providing access to my data):

`# mount /dev/ad6s1 /tmp/old`

UPDATE: I tried this again last night and made sure that I had issued the following command BEFORE removing ad6 from the production server:

`# gmirror remove gm0 ad6`

This should have cleared the metadata on ad6, correct? The result was that I WAS ABLE TO MOUNT ad6s1g on the 'temp' box! Hopefully I have uncovered the immediate problem.

But it leaves the following question (future scenario):

Should I have a full failure of the production machine and am therefore unable to issue the 'gmirror remove' cmd on THAT machine, can I instead take ad6 to the 'temp' box, and issue 'gmirror clear ad6' to get the same result?? That is, will I likely then be able to mount ad6s1g?

Thanks very much in advance for help/thoughts on this.


----------



## phoenix (Nov 6, 2010)

There's the problem.  You don't want to use *gmirror remove*.  That deletes the gmirror metadata on the drive, which clears the partition information.

Instead, just physically remove the drive form the system.  gmirror will continue to run in a DEGRADED mode.

Then install the drive into the temp server, start gmirror, and access the gm0 device the same way as on the production system.


----------



## pmorrill (Nov 12, 2010)

Thanks for your help: my upgrade went well and the gmirror system seems to be under control!


----------

