Labels "disappear" after zpool import

Hah I was just going to post what HarryE posted. ... only one day later. But since you want the non-gpt labels, it would be more like:

# zpool import -d /dev/label/ yourpool

And btw your script looks nice, but you could also try:

# zpool labelclear /dev/da0

This works fine for me, but if you put zfs on a slice, and changed the end sector of the slice BEFORE running labelclear, then I guess some junk could be left behind. (and I don't think this gets the glabel stuff, but glabel has the "destroy" command too)

And on Linux, you use:
# wipefs -a /dev/sdX#
# mdadm --zero-superblock /dev/sdX#

Sadly, wipefs isn't always included on rescue CDs. But it does a great job for all known filesystems. I doubt it would work on zfs. And it doesn't zero everything like your script, but it also might reach things outside the bounds of your script too.
 
peetaur said:
Hah I was just going to post what HarryE posted. ... only one day later. But since you want the non-gpt labels, it would be more like:

# zpool import -d /dev/label/ yourpool

And btw your script looks nice, but you could also try:

# zpool labelclear /dev/da0

This works fine for me, but if you put zfs on a slice, and changed the end sector of the slice BEFORE running labelclear, then I guess some junk could be left behind. (and I don't think this gets the glabel stuff, but glabel has the "destroy" command too)

And on Linux, you use:
# wipefs -a /dev/sdX#
# mdadm --zero-superblock /dev/sdX#

Sadly, wipefs isn't always included on rescue CDs. But it does a great job for all known filesystems. I doubt it would work on zfs. And it doesn't zero everything like your script, but it also might reach things outside the bounds of your script too.

Yeah you can import like that now, yes. You couldn´t when I wrote it:p

And with gpart destroy and zpool labelclear, you can only do one disk at a time. The tool I wrote is capable of doing:
# cleandrives da0 da1 da2 da3 da4 da5 da6 da7 da8 da9 ...
To clear an entire JBOD in 30secs :)

/Sebulon
 
Nikhil123 said:
zpool import -d /dev/label
Works very fine as required.

Again, yes that is possible to do now, but that command was not available back when i wrote it.

/Sebulon
 
Read the man page for zpool. especially the section for import. Especially the part about -d.

You should do a 'zpool import -d /dev/label poolname' at least once. that will populate the zpool.cache with the label paths, allowing the subsequent imports to work correctly.
 
phoenix said:
Read the man page for zpool. especially the section for import. Especially the part about -d.

You should do a 'zpool import -d /dev/label poolname' at least once. that will populate the zpool.cache with the label paths, allowing the subsequent imports to work correctly.

OK, I´m hoping the third time´s the charm here... Listen, yes, that is the correct way of dealing with this type of problem, now. But zpool import -d did not exist when this thread was started and I wrote that script just to make the workaround a little less time-consuming.

@All

If anyone ever finds themselves in a position where they´ve created a zpool with labels and a export/import makes them disappear, here´s what you do:
# zpool export poolname
# zpool import -d /dev/(gpt/label) poolname

And you should have the pool back again with the label names, instead of the partition names or gpt id´s. I´m also going to mark this thread as solved for future reference. Wondering why I haven´t done that already...:)

/Seblulon
 
Back
Top