从“FAULTED”zfs 池中恢复。“-F”选项似乎被忽略

从“FAULTED”zfs 池中恢复。“-F”选项似乎被忽略

在 Ubuntu 上,我最近开始在外部 USB 硬盘上试用 ZFS。现在我的 zfs 池似乎已损坏,这可能是由于我关闭计算机(使用poweroff)导致的。

$ zpool import
   pool: zfs
     id: 1234512345123451234
  state: FAULTED
 status: The pool metadata is corrupted.
 action: The pool cannot be imported due to damaged devices or data.
    The pool may be active on another system, but can be imported using
    the '-f' flag.
   see: http://zfsonlinux.org/msg/ZFS-8000-72
 config:

        zfs                      FAULTED  corrupted data
          usb-Disk_Name_etc-0:0  ONLINE

当尝试导入它时,我收到此有用的消息,解释说我将丢失大约 1 秒的数据(这没关系)并且我可以尝试使用“-F”选项进行恢复:

$ zpool import zfs
cannot import 'zfs': I/O error
    Recovery is possible, but will result in some data loss.
    Returning the pool to its state as of Thu 12 Mar 2020 00:58:03 GMT
    should correct the problem.  Approximately 1 seconds of data
    must be discarded, irreversibly.  Recovery can be attempted
    by executing 'zpool import -F zfs'.  A scrub of the pool
    is strongly recommended after recovery.

使用 dry-run 标志,我确认 -F 应该可以工作:

$ zpool import -Fn zfs
Would be able to return zfs to its state as of Thu 12 Mar 2020 00:58:03 GMT.
Would discard approximately 1 seconds of transactions.

但是,当我尝试真实的东西时,它似乎完全忽略了“-F”选项并重复原始消息:

$ zpool import -F zfs
cannot import 'zfs': I/O error
    Recovery is possible, but will result in some data loss.
    Returning the pool to its state as of Thu 12 Mar 2020 00:58:03 GMT
    should correct the problem.  Approximately 1 seconds of data
    must be discarded, irreversibly.  Recovery can be attempted
    by executing 'zpool import -F zfs'.  A scrub of the pool
    is strongly recommended after recovery.

我从这个答案中发现了“-X”选项的提及:https://serverfault.com/a/645866/74394但我仍然收到完全相同的消息。我尝试了所有这些选项组合,包括池名称 (zfs) 和数字 ID 号(如 1234512345123451234),但我总是收到与上面完全相同的消息,建议使用 -F 选项。

-F -FX -f -fF -fFX

我在这里做错了什么吗?如果由于系统关闭而导致 1 秒钟的数据丢失,导致整个磁盘无法挽回,ZFS 似乎非常不稳定!我没有池的备份副本,因为我才刚刚开始尝试 ZFS。感谢您的帮助。

答案1

如果该 USB 设备在提交方面撒谎,那么所有的赌注都会失效,因为写入可能会被重新排序,而在写入重新排序和在屏障方面撒谎之间,所有的赌注都无法确定元数据是否被破坏。

尝试:zdb -e zfs -ul

希望这会列出一些 txgs。

然后尝试:zpool import -f -FX -N -T [txg_number]

您从上面的 zdb 中获得了 txg_number。

其他尝试:将 ZFS 更新至最新 0.8.3。Ubuntu 附带的版本相当老旧,自该版本以来已有很多修复和改进。

相关内容