How to destroy an incorrectly created gmirror?

I have a system set up with a mirrored ZFS root pool, on top of GPT partitions. I created seperate GPT partitions for swap:

Code:
=>       34  488281183  ada0  GPT  (232G)
         34         94        - free -  (47k)
        128        128     1  freebsd-boot  (64k)
        256    8388608     2  freebsd-swap  (4.0G)
    8388864  479892353     3  freebsd-zfs  (228G)

=>       34  488281183  ada1  GPT  (232G)
         34         94        - free -  (47k)
        128        128     1  freebsd-boot  (64k)
        256    8388608     2  freebsd-swap  (4.0G)
    8388864  479892353     3  freebsd-zfs  (228G)

I've been using the two swap partitions as individual swap spaces so far, but now I want to mirror them.

However, I made a mistake in the command to create the mirror, missing out its name. Instead of typing
# gmirror label -b round-robin swap ada0p2 ada1p2
I typed
# gmirror label -b round-robin ada0p2 ada1p2

I now have a mirror device named /dev/mirror/ada0p2 containing only one provider, /dev/ada1p2.

I want to destroy this device and start over, but no matter what gmirror command I invoke, I just can't get that mirror device to go away.

It appears that each time I try to invoke
# gmirror stop ada0p2
it's working, but then it is immediately relaunching the mirror after redetecting the ada1p2 provider, by its gptid instead:

Code:
root@beastie:/root # gmirror status
         Name    Status  Components
mirror/ada0p2  COMPLETE  ada1p2 (ACTIVE)

root@beastie:/root # gmirror stop ada0p2

root@beastie:/root # gmirror status
         Name    Status  Components
mirror/ada0p2  COMPLETE  gptid/0edb2906-4393-11e2-a1f3-bc305bdab396 (ACTIVE)
The kernel messages show:
Code:
GEOM_MIRROR: Device ada0p2: provider mirror/ada0p2 destroyed.
GEOM_MIRROR: Device ada0p2 destroyed.
GEOM_MIRROR: Device mirror/ada0p2 launched (1/1).

Repeated attempts to stop the mirror just result in it redetecting the ada1p2 provider by alternating between its device name and its gptid and relaunching the mirror.

What's the proper way to resolve this?
 
I figured it out.

I used
# gmirror deactivate ada0p2 ada1p2
to mark the sole ada1p2 provider as inactive, so it would not be automatically connected to the mirror.

Then after
# gmirror stop ada0p2
the mirror device wasn't able to immediately relaunch itself.

I then cleared the metadata from ada1p2, restoring things to a fresh state.
 
That's weird

At about exactly the same time as you, I was setting up a gmirror on two disks, ada0 & ada1, partitioned with 64k boot, 4G swap and the rest for the system.

Long story short, I had a few problems (turned out dodgy RAM was playing havok) and had to recreate everything. I think I went through the exact same process trying to get rid of the old mirror info. Trying to destroy the device just brought it back using the gptid label. If I tried to destroy the mirror it just re-loaded gmirror and found it again. Like you, I got there in the end but it was a bit of a PITA.
 
gmirror remove will remove a drive from a mirror and clear the metadata. If the mirror is not active, gmirror clear will just remove the metadata.
 
Back
Top