btrfs check除非您真正知道自己在做什么,否则请勿使用!它可能会破坏您的文件系统!

btrfs check除非您真正知道自己在做什么,否则请勿使用!它可能会破坏您的文件系统!

我一直在使用 Btrfs 文件系统向 3TB USB 外部硬盘驱动器 (WD MyBook) 写入数据,这时我不小心关闭了驱动器电源模块的电源。

奇怪的是——写操作似乎仍在继续(我预计会立即出现 I/O 错误)。我已手动终止该rsync进程并尝试重新挂载文件系统。

/dev/sdf节点仍然存在,但我无法安装它。

我已经尝试过了partprobe,但btrfs device scan没有成功。

重新启动后,我无法再次挂载文件系统。我在驱动器上运行了一个btrfs rescue chunk-recover -v,大约 14 小时后发现:

(A long list of good chunks)
Chunk: start = 1992919351296, len = 1073741824, type = 1, num_stripes = 1
      Stripes list:
      [ 0] Stripe: devid = 1, offset = 1975739482112
      No block group.
      Device extent list:
          [ 0]Device extent: devid = 1, start = 1975739482112, len = 1073741824, chunk offset = 1992919351296
  Chunk: start = 1993993093120, len = 1073741824, type = 1, num_stripes = 1
      Stripes list:
      [ 0] Stripe: devid = 1, offset = 1976813223936
      No block group.
      Device extent list:
          [ 0]Device extent: devid = 1, start = 1976813223936, len = 1073741824, chunk offset = 1993993093120
Unrecoverable Chunks:
  Chunk: start = 1995066834944, len = 1073741824, type = 1, num_stripes = 1
      Stripes list:
      [ 0] Stripe: devid = 1, offset = 1977886965760
      No block group.
      No device extent.
  Chunk: start = 1996140576768, len = 1073741824, type = 1, num_stripes = 1
      Stripes list:
      [ 0] Stripe: devid = 1, offset = 1978960707584
      No block group.
      No device extent.
  Chunk: start = 1997214318592, len = 1073741824, type = 1, num_stripes = 1
      Stripes list:
      [ 0] Stripe: devid = 1, offset = 1980034449408
      No block group.
      No device extent.
  Chunk: start = 1998288060416, len = 1073741824, type = 1, num_stripes = 1
      Stripes list:
      [ 0] Stripe: devid = 1, offset = 1981108191232
      No block group.
      No device extent.
  Chunk: start = 1361559158784, len = 1073741824, type = 1, num_stripes = 0
      Stripes list:
      Block Group: start = 1361559158784, len = 1073741824, flag = 1
      No device extent.

Total Chunks:           1850
  Recoverable:          1845
  Unrecoverable:        5

Orphan Block Groups:

Orphan Device Extents:

parent transid verify failed on 1634923266048 wanted 1530 found 1532
parent transid verify failed on 1634923266048 wanted 1530 found 1532
Ignoring transid failure
Couldn't setup extent tree
open with broken chunk error
Chunk tree recovery failed

在一长串块之后,有一些是无法恢复的。这意味着什么?

我已经尝试了所有可能的 btrfs 命令,包括擦洗、检查、--init-extent-tree、零日志,但最终都没有执行任何类似的输出:

# btrfs check -p /dev/sdc
Opening filesystem to check...
parent transid verify failed on 1634923266048 wanted 1530 found 1532
parent transid verify failed on 1634923266048 wanted 1530 found 1532
Ignoring transid failure
Couldn't setup extent tree
ERROR: cannot open file system

我是否有可能因意外断电而彻底毁掉了 Btrfs 文件系统?

您可以在这里找到有关此案例的更多详细信息: https://forum.manjaro.org/t/unfixable-btrfs-filesystem-after-a-power-failure/80994

答案1

btrfs check除非您真正知道自己在做什么,否则请勿使用!它可能会破坏您的文件系统!

我联系了 Btrfs 邮件列表,了解到任何使用都btrfs check --repair可能导致文件系统损坏增加。

看起来我在一个小问题后愚蠢地使用了该命令,导致文件系统变砖。

当您运行它来阅读帮助时,它会显示警告:

# btrfs check
btrfs check: too few arguments
usage: btrfs check [options] <device>

    Check structural integrity of a filesystem (unmounted).

    Check structural integrity of an unmounted filesystem. Verify internal
    trees' consistency and item connectivity. In the repair mode try to
    fix the problems found. 
    WARNING: the repair mode is considered dangerous and should not be used
             without prior analysis of problems found on the filesystem.

更多信息: https://btrfs.wiki.kernel.org/index.php/Btrfsck

相关内容