我在具有全磁盘加密的系统上运行 Arch Linux,存储是 Samsung 950 Pro NVMe 驱动器 (512 GB)。这台电脑已经用了几个月了。到目前为止没有不良行为。 (我只使用了磁盘上 512 空间中的 21 GB。)
btrfs-progs v4.5.1
今天我正常使用我的系统并浏览网页。 Firefox 突然停止响应,而且没有明显的原因。然后等离子停止响应。我无法退出 KDE。
我终止了我的用户会话(pkill -u me),然后我厌倦了 startx。那时我注意到我的根文件系统是只读的。
第一步,我重新启动。那没有任何帮助。
根文件系统将不会挂载。这是错误信息:
running hook [encrypt]
performing fsck on /dev/mapper/cryptroot
mounting /dev/mapper/cryptroot on real root
BTRFS error (device dm-0) in btrfs_replay_log: 2421: errno=-22 unknown (failed to recover log tree)
BTRFS error (device dm-0): cleaner transaction attach returned -30
BTRFS open_ctree failed
mount: wrong fs type, bad option, bad superblock on /dev/mapper/cryptroot
dropped into emergency shell
我手写的,所以小标点符号是消息不准确等。
Journalctl -p3 不会报告任何看起来与此相关的内容。
编辑: 多次重启都无法解决。错误还是一样。
我启动到 LiveUSB 环境并运行以下命令:
cryptsetup open --type luks /dev/xxx cryptroot
mount -t btrfs -o noatime,nodiratime,ssd,compress=lzo,defaults,space_cache,subvolid=257 /dev/mapper/cryptroot /mnt
错误信息也是一样的:
[ 2300.967048] BTRFS info (device dm-0): use ssd allocation scheme
[ 2300.967058] BTRFS info (device dm-0): use lzo compression
[ 2300.967066] BTRFS info (device dm-0): disk space caching is enabled
[ 2300.967069] BTRFS: has skinny extents
[ 2300.995393] BTRFS: error (device dm-0) in btrfs_replay_log:2413: errno=-22 unknown (Failed to recover log tree)
[ 2300.997617] BTRFS info (device dm-0): delayed_refs has NO entry
[ 2300.997673] BTRFS error (device dm-0): cleaner transaction attach returned -30
[ 2301.035405] BTRFS: open_ctree failed
编辑2:
基于这两个链接:
https://btrfs.wiki.kernel.org/index.php/Problem_FAQ
https://btrfs.wiki.kernel.org/index.php/Btrfs-zero-log
我决定冒险运行这个命令:
btrfs rescue zero-log
这有效,我可以挂载文件系统。
编辑3:
我运行了 btrfs check --repair。这是输出:
root@broken / # umount /mnt
root@broken / # btrfs check --repair /dev/mapper/cryptroot
enabling repair mode
Checking filesystem on /dev/mapper/cryptroot
checking extents
bad metadata [292414476288, 292414492672) crossing stripe boundary
bad metadata [292414541824, 292414558208) crossing stripe boundary
bad metadata [292414672896, 292414689280) crossing stripe boundary
bad metadata [292414869504, 292414885888) crossing stripe boundary
bad metadata [292415000576, 292415016960) crossing stripe boundary
bad metadata [292415066112, 292415082496) crossing stripe boundary
bad metadata [292415131648, 292415148032) crossing stripe boundary
bad metadata [292415262720, 292415279104) crossing stripe boundary
bad metadata [292415328256, 292415344640) crossing stripe boundary
bad metadata [292415393792, 292415410176) crossing stripe boundary
repaired damaged extent references
Fixed 0 roots.
checking free space cache
cache and super generation don't match, space cache will be invalidated
checking fs roots
checking csums
checking root refs
checking quota groups
Ignoring qgroup relation key 258
Ignoring qgroup relation key 263
Ignoring qgroup relation key 71776119061217538
Ignoring qgroup relation key 71776119061217543
Counts for qgroup id: 257 are different
our: referenced 10412273664 referenced compressed 10412273664
disk: referenced 10411311104 referenced compressed 10411311104
diff: referenced 962560 referenced compressed 962560
our: exclusive 10412273664 exclusive compressed 10412273664
disk: exclusive 10412273664 exclusive compressed 10412273664
found 21570773057 bytes used err is 0
total csum bytes: 19563456
total tree bytes: 403767296
total fs tree bytes: 349667328
total extent tree bytes: 27328512
btree space waste bytes: 66313360
file data blocks allocated: 39882014720
referenced 28043988992
extent buffer leak: start 20987904 len 16384
extent buffer leak: start 292688068608 len 16384
extent buffer leak: start 60915712 len 16384
extent buffer leak: start 29569581056 len 16384
extent buffer leak: start 29569597440 len 16384
extent buffer leak: start 292412063744 len 16384
extent buffer leak: start 292405870592 len 16384
extent buffer leak: start 292405936128 len 16384
extent buffer leak: start 292413964288 len 16384
然后我查看dmesg,看到了这样的错误信息:
[ 4925.562422] BTRFS info (device dm-0): use ssd allocation scheme
[ 4925.562432] BTRFS info (device dm-0): use lzo compression
[ 4925.562440] BTRFS info (device dm-0): disk space caching is enabled
[ 4925.562444] BTRFS: has skinny extents
[ 4925.578705] BTRFS error (device dm-0): qgroup generation mismatch, marked as inconsistent
[ 4925.584033] BTRFS: checking UUID tree
我的问题:
- 是什么原因造成的呢?
- 接下来我应该做什么?
脱靶参考: https://wiki.archlinux.org/index.php/Btrfs#BTRFS:_open_ctree_failed (这似乎不是我的问题。我没有多设备 btrfs fs 并且我没有在 /etc/mkinitcpio.conf 的 HOOKS 中使用 btrfs)