ZFS and How to Access Missing Pools


#1

Summary:

When you cannot access your zfs pools, you can use “zpool import -d /dev” to discover their pool name, id, state and status, then use “zpool import -f pool-name” to force the import of your pool.

The Problem:

I had a PCBSD 10.3 system with three hard disks (da0, da1, and da2), all using zfs. Disks da1 and da2 each held a separate zpool. The root hard disk died while the zfs pools on da1 and da2 were imported. I replaced the dead disk with a new one and installed TrueOS 12.7 (FreeBSD 12.0-CURRENT #10 d26791952 (trueos-stable-17.12): Sat Dec 9 18:10:09 UTC 2017). I was concerned when I ran the commands “zpool import pool-name”. The commands “zpool get all”, “zpool status”, and “zfs list” showed only the default pool on da0. I was shocked when I ran the gpart command “gpart show -l da1” directed at both da1 and da2 which reported the pools were “corrupt.”

====== Code =====

gpart show -l da1

=> 34 3907029101 da1 GPT (1.8T) [CORRUPT]
34 3907029101 1 (null) (1.8T)

gpart show -l da2

=> 34 3907029101 da2 GPT (1.8T) [CORRUPT]
34 3907029101 1 (null) (1.8T)
===== End Code =====

I was somewhat relieved when I confirmed that the da1 and da2 did contain a zfs file system:

====== Code =====

fstyp -u /dev/da1

zfs

fstyp -u /dev/da2

zfs
===== End Code =====

The pools did not showing because the problem was that “the pool has been written to from another host, and was not cleanly exported from the other system.” The fix turned out to be simple:

The Solution:

  1. Discover pool names with # zpool import -d /dev

====== Code =====

zpool import -d /dev

pool: zp2
id: 6805923915288413260
state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
the ‘-f’ flag.
see: http://illumos.org/msg/ZFS-8000-EY
config:
zp2 ONLINE
da2 ONLINE

pool: zp1
id: 6973413564568501136
state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
the ‘-f’ flag.
see: http://illumos.org/msg/ZFS-8000-EY

config:
zp1 ONLINE
da1 ONLINE
===== End Code =====

  • 2 Import pool with -f flag:

====== Code =====

zpool import -f zp1

zpool import -f zp2

    1. Confirm Import:

====== Code =====

zpool list

NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
irtos 460G 10.7G 449G - 1% 2% 1.00x ONLINE -
zp1 1.81T 356G 1.47T - 3% 19% 1.00x ONLINE -
zp2 1.81T 877G 979G - 19% 47% 1.00x ONLINE -
===== End Code =====

Credit and thanks go to FreeBSD Forum member phoenix for his post #12 at https://forums.freebsd.org/threads/49782/ and to the unknown author of the message at http://illumos.org/msg/ZFS-8000-EY

Ian Robinson
Salem, Ohio


#2

Very nice. Thanks for posting this.


#3

As @mer said, thank you

Do me a favor though.

Create a topic in the Tips, Tricks, FAQ, and link this in the thread.


#4

Thank you Mer and Rod.

Re: Posting in “Tips, Tricks, FAQ, and link this in the thread”

I do not see how to do this since there is not a “create new topic” or other method that is obvious. Tips and Tricks is a post under Help & Support. Do I go to Tips & Tricks and “reply” to a post and then enter the link?


TrueOS Tips, Tricks, and FAQ
#5

Yes, that is all you need to do.