Hi!
I know this is an old thread, but it seems to be the go-to-thread when searching fot this topic in the Interwebs.
The commands here helped me get rid of a "zombie" test pool that was not available anymore. However, in my case I received more than I bargained for. In my case, the singe partition of a drive was in use by a pool, but the drive itself had remnants of an unavailabe pool:
Pool "murdock" unavailable, label can be found on ada0 (and ada1):
Code:
nas4free: /proc# zpool import
pool: murdock
id: 16803376907535956312
state: UNAVAIL
status: One or more devices are missing from the system.
action: The pool cannot be imported. Attach the missing
devices and try again.
see: http://illumos.org/msg/ZFS-8000-3C
config:
murdock UNAVAIL insufficient replicas
12889769627032609724 UNAVAIL cannot open
6904202065765623145 UNAVAIL cannot open
nas4free: /proc# zdb -l /dev/ada0
--------------------------------------------
LABEL 0
--------------------------------------------
failed to unpack label 0
--------------------------------------------
LABEL 1
--------------------------------------------
failed to unpack label 1
--------------------------------------------
LABEL 2
--------------------------------------------
version: 5000
name: 'murdock'
state: 1
txg: 6687893
pool_guid: 16803376907535956312
hostid: 3343067376
hostname: 'nas4free.local'
top_guid: 12889769627032609724
guid: 12889769627032609724
vdev_children: 2
vdev_tree:
type: 'disk'
id: 0
guid: 12889769627032609724
path: '/dev/gpt/se3t_1p2'
phys_path: '/dev/gpt/se3t_1p2'
whole_disk: 1
metaslab_array: 37
metaslab_shift: 32
ashift: 12
asize: 800588300288
is_log: 0
DTL: 375
create_txg: 4
features_for_read:
com.delphix:hole_birth
com.delphix:embedded_data
--------------------------------------------
LABEL 3
--------------------------------------------
failed to unpack label 3
ada0p1 (and ada1p1) are in use by pool "hannibal":
Code:
nas4free: /proc# gpart list ada0
Geom name: ada0
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 5860533134
first: 34
entries: 128
scheme: GPT
Providers:
1. Name: ada0p1
Mediasize: 3000592940544 (2.7T)
Sectorsize: 512
Stripesize: 4096
Stripeoffset: 0
Mode: r1w1e2
rawuuid: 14752c4a-b1f1-11e3-b466-38eaa7a49c0d
rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
label: se3t_1p1
length: 3000592940544
offset: 24576
type: freebsd-zfs
index: 1
end: 5860533134
start: 48
Consumers:
1. Name: ada0
Mediasize: 3000592982016 (2.7T)
Sectorsize: 512
Stripesize: 4096
Stripeoffset: 0
Mode: r1w1e3
My assumption was that the labelclear command would clear the label info only on the device/geometry given as parameter. The error message when starting the command without "-f" option seems to confirm this assumption (i.e. only the label of the unavailable pool "murdock" will be removed):
Code:
[root@nas4free /proc]# zpool export hannibal
[root@nas4free /proc]# zpool labelclear /dev/ada0
labelclear operation failed.
Vdev /dev/ada0 is a member of the exported pool "murdock".
Use "zpool labelclear -f /dev/ada0" to force the removal of label
information.
[root@nas4free /proc]# zpool labelclear -f /dev/ada0
[root@nas4free /proc]# zpool labelclear /dev/ada1
labelclear operation failed.
Vdev /dev/ada1 is a member of the exported pool "murdock".
Use "zpool labelclear -f /dev/ada1" to force the removal of label
information.
[root@nas4free /proc]# zpool labelclear -f /dev/ada1
[root@nas4free /proc]# zdb -l /dev/ada0
--------------------------------------------
LABEL 0
--------------------------------------------
failed to unpack label 0
--------------------------------------------
LABEL 1
--------------------------------------------
failed to unpack label 1
--------------------------------------------
LABEL 2
--------------------------------------------
failed to unpack label 2
--------------------------------------------
LABEL 3
--------------------------------------------
failed to unpack label 3
[root@nas4free /proc]# zdb -l /dev/ada1
--------------------------------------------
LABEL 0
--------------------------------------------
failed to unpack label 0
--------------------------------------------
LABEL 1
--------------------------------------------
failed to unpack label 1
--------------------------------------------
LABEL 2
--------------------------------------------
failed to unpack label 2
--------------------------------------------
LABEL 3
--------------------------------------------
failed to unpack label 3
Ok, time to re-import the "hannibal" pool from ada0p1/ada1p1 again:
Code:
[root@nas4free /proc]# zpool import hannibal
cannot import 'hannibal': no such pool available
[root@nas4free /proc]# zdb -l /dev/ada
ada0 ada1 ada2 ada2p1 ada3 ada3p1 ada4 ada4s1 ada4s1a ada4s2
[root@nas4free /proc]# gpart show ada0
gpart: No such geom: ada0.
[root@nas4free /proc]# gpart show /dev/ada0
gpart: No such geom: /dev/ada0.
[root@nas4free /proc]# gpart list ada0
gpart: No such geom: ada0.
[root@nas4free /proc]# gpart list /dev/ada0
gpart: No such geom: /dev/ada0.
[root@nas4free /proc]# fdisk /dev/ada0
******* Working on device /dev/ada0 *******
parameters extracted from in-core disklabel are:
cylinders=5814021 heads=16 sectors/track=63 (1008 blks/cyl)
Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=5814021 heads=16 sectors/track=63 (1008 blks/cyl)
fdisk: invalid fdisk partition table found
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
start 63, size 1565565057 (764436 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 755/ head 15/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
[root@nas4free /]# gpart list -a | grep name
Geom name: ada2
Geom name: ada3
Geom name: ada4
Geom name: ada4s1
[root@nas4free /]# gpart show -r
=> 34 5860533101 ada2 GPT (2.7T)
34 4062 - free - (2.0M)
4096 5859373056 1 516e7cba-6ecf-11d6-8ff8-00022d09712b (2.7T)
5859377152 1155983 - free - (564M)
=> 34 5860533101 ada3 GPT (2.7T)
34 4062 - free - (2.0M)
4096 5859373056 1 516e7cba-6ecf-11d6-8ff8-00022d09712b (2.7T)
5859377152 1155983 - free - (564M)
=> 63 117231345 ada4 MBR (56G)
63 1654632 1 165 [active] (808M)
1654695 63 - free - (32K)
1654758 115576587 2 165 (55G)
117231345 63 - free - (32K)
=> 0 1654632 ada4s1 BSD (808M)
0 8129 - free - (4.0M)
8129 1638400 1 7 (800M)
1646529 8103 - free - (4.0M)
Oops! Seems like "labelclear" did not only clear the lable, but it wiped all GPT info from the device, taking the partitions and the production pool residing on them with it.
I know I could have done a few things smarter than I did (like testing the process on only one of the two drives that formed my mirrored pool "hannibal" first, I then yould have re-created the mirror), but the fact that the labelclear command takes its clearing job
this serious is absolutely not clear from the very "light" (to put it mildly) info in the manpages. I'm glad I had a backup.
This post is for others like me who stumble over zombie pools on used devices in the hopes they do not make the same mistake as I did.
Cheers
Alex