我如何恢复我的 ZFS 池,它突然离线并报告它“最后被另一个系统使用”?

Kay*_* II 4 freebsd zfs data-recovery truenas

tl;dr:我正在一台具有 16GB ECC 内存的服务器上运行带有 ZFS 的 FreeBSD 11.2 NAS 服务器。我发现我的主池消失了。ZFS 可以看到该池,但报告故障ZFS-8000-EY ,但cannot import \'tank\': pool may be in use from other system, it was last accessed by nasserver (hostid: 0xaaaaaaaa) on Sat Apr 13 04:16:22 2019该池从未被其他系统使用过,并且nasserver是当前主机。我担心我的池已损坏。我应该做什么来尝试恢复它?我有备份,但它们已经过时了,因为我必须手动进行备份。我还没有尝试逃跑zpool import -f tank,因为我想小心避免让事情变得更糟。

\n\n
\n\n

完整问题:

\n\n

我正在运行带有 ZFS 的 FreeBSD 11.2 NAS 服务器。我度假回来发现服务器已启动,但 NAS 卷无法访问。当我 ssh 进入盒子时,我发现我的人池tank丢失了:

\n\n
root@nasserver:/home/root # zpool status   pool: zroot state: ONLINE status: Some supported features are not enabled on the pool. The pool can\n        still be used, but some features are unavailable. action: Enable all features using \'zpool upgrade\'. Once this is done,\n        the pool may no longer be accessible by software that does not support\n        the features. See zpool-features(7) for details.   scan: scrub repaired 0 in 0h0m with 0 errors on Sat Mar 23 03:01:44 2019 config:\n\n\n        NAME                                  STATE     READ WRITE CKSUM\n        zroot                                 ONLINE       0     0     0\n          mirror-0                            ONLINE       0     0     0\n            diskid/DISK-XXXXXXXXXXXXXXXXXXX1  ONLINE       0     0     0\n            diskid/DISK-XXXXXXXXXXXXXXXXXXX2  ONLINE       0     0     0\n\n\nerrors: No known data errors\n
Run Code Online (Sandbox Code Playgroud)\n\n

这些驱动器似乎可用,我尝试导入它们,但 ZFS 报告它cannot import \'tank\': pool may be in use from other system, it was last accessed by nasserver (hostid: 0xaaaaaaaa) on Sat Apr 13 04:16:22 2019。这很奇怪,因为我从未在其他系统上使用过这些磁盘,并且报告的主机名是它们所连接到的计算机的主机名:

\n\n
root@nasserver:/home/root # zpool import\n\xc2\xa0\xc2\xa0 pool: tank\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0 id: 12345678901234567901\n\xc2\xa0 state: ONLINE\nstatus: The pool was last accessed by another system.\naction: The pool can be imported using its name or numeric identifier and\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0 the \'-f\' flag.\n\xc2\xa0\xc2\xa0 see: http://illumos.org/msg/ZFS-8000-EY\nconfig:\n\n\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0 tank\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0 ONLINE\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0 raidz1-0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0 ONLINE\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0 gpt/tank-1      \xc2\xa0\xc2\xa0\xc2\xa0 ONLINE\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0 gpt/tank-2      \xc2\xa0\xc2\xa0\xc2\xa0 ONLINE\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0 gpt/tank-3\xc2\xa0      \xc2\xa0\xc2\xa0 ONLINE\n\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0 gpt/tank-4        \xc2\xa0 ONLINE\n\n\nroot@nasserver:/home/root # zpool import tank\ncannot import \'tank\': pool may be in use from other system, it was last accessed by nasserver (hostid: 0xaaaaaaaa) on Sat Apr 13 04:16:22 2019\nuse \'-f\' to import anyway\n
Run Code Online (Sandbox Code Playgroud)\n\n

我担心我的池可能已损坏。我有备份,但它们有些过时了。我应该怎样做才能恢复我的池?

\n

Jim*_*ter 5

zpool import -f tank,就像错误对话框中所说的那样。

这是一个相当罕见的错误,但我以前见过它发生过(在过去十年中,可能在 100 多台机器上发生过一两次);如果主机名和可能的其他魔法发生了变化,zfs不会自动导入池,因为(可能是过度的)警告,这可能不是池所属的机器。使用-f忽略该警告,噗,这是你的池(它应该在下一轮自动导入)。

可能是在崩溃或断电导致系统关闭而池在关闭过程中无法正确导出之后发生的。