了解 btrfs dmesg

了解 btrfs dmesg

根据我找到的文档https://btrfs.wiki.kernel.org/index.php/Data_Structures我很难理解以下 dmesg

[  173.946830] device fsid 02cc6d9f-28c6-45f4-b69e-f3ec8d6c24a5 devid 1 transid 21 /dev/loop0
[  173.947044] device fsid 02cc6d9f-28c6-45f4-b69e-f3ec8d6c24a5 devid 1 transid 21 /dev/loop0
[  173.947541] btrfs: disk space caching is enabled
[  174.000257] btrfs: mismatching generation and generation_v2 found in root item. This root was probably mounted with an older kernel. Resetting all new fields.
[  174.012216] parent transid verify failed on 30113792 wanted 13 found 35
[  174.018261] parent transid verify failed on 30113792 wanted 13 found 35
[  174.057499] btrfs: open_ctree failed

哪棵树出了什么问题?更具体地说,什么是 btrfs 父 transid?

root@v7:/srv# btrfs-debug-tree -b 30113792 disk
parent transid verify failed on 30113792 wanted 13 found 35
parent transid verify failed on 30113792 wanted 13 found 35
parent transid verify failed on 30113792 wanted 13 found 35
parent transid verify failed on 30113792 wanted 13 found 35
Ignoring transid failure
leaf 30113792 items 18 free space 447 generation 35 owner 5
fs uuid 02cc6d9f-28c6-45f4-b69e-f3ec8d6c24a5
chunk uuid 73044589-a58e-4314-891f-1d9ce4b53540
    item 0 key (51372 INODE_ITEM 0) itemoff 3835 itemsize 160
        inode generation 28 transid 31 size 655 block group 0 mode 100640 links 1
    item 1 key (51372 INODE_REF 477) itemoff 3818 itemsize 17
        inode ref index 356 namelen 7 name: nshadow
    item 2 key (51372 EXTENT_DATA 0) itemoff 3142 itemsize 676
        inline extent data size 655 ram 655 compress 0
    item 3 key (51401 INODE_ITEM 0) itemoff 2982 itemsize 160
        inode generation 32 transid 33 size 59 block group 0 mode 100640 links 1
    item 4 key (51401 INODE_REF 51225) itemoff 2962 itemsize 20
        inode ref index 34 namelen 10 name: dmesg.1.gz
    item 5 key (51401 EXTENT_DATA 0) itemoff 2882 itemsize 80
        inline extent data size 59 ram 59 compress 0
    item 6 key (51402 INODE_ITEM 0) itemoff 2722 itemsize 160
        inode generation 32 transid 32 size 25630 block group 0 mode 100640 links 1
    item 7 key (51402 INODE_REF 51225) itemoff 2707 itemsize 15
        inode ref index 37 namelen 5 name: dmesg
    item 8 key (51402 EXTENT_DATA 0) itemoff 2654 itemsize 53
        extent data disk byte 699076608 nr 28672
        extent data offset 0 nr 28672 ram 28672
        extent compression 0
    item 9 key (51428 INODE_ITEM 0) itemoff 2494 itemsize 160
        inode generation 34 transid 34 size 598 block group 0 mode 100644 links 1
    item 10 key (51428 INODE_REF 477) itemoff 2480 itemsize 14
        inode ref index 460 namelen 4 name: mtab
    item 11 key (51428 EXTENT_DATA 0) itemoff 1861 itemsize 619
        inline extent data size 598 ram 598 compress 0
    item 12 key (51429 INODE_ITEM 0) itemoff 1701 itemsize 160
        inode generation 34 transid 35 size 538 block group 0 mode 100644 links 1
    item 13 key (51429 INODE_REF 51225) itemoff 1683 itemsize 18
        inode ref index 38 namelen 8 name: boot.log
    item 14 key (51429 EXTENT_DATA 0) itemoff 1124 itemsize 559
        inline extent data size 538 ram 538 compress 0
    item 15 key (51430 INODE_ITEM 0) itemoff 964 itemsize 160
        inode generation 34 transid 35 size 134888 block group 0 mode 100644 links 1
    item 16 key (51430 INODE_REF 51225) itemoff 950 itemsize 14
        inode ref index 39 namelen 4 name: udev
    item 17 key (51430 EXTENT_DATA 0) itemoff 897 itemsize 53
        extent data disk byte 698941440 nr 135168
        extent data offset 0 nr 135168 ram 135168
        extent compression 0
root@v7:/srv# 

我也很难理解为什么 btrfs 无法通过创建一个新的 transid 36 并尝试挂载 fs 来恢复?

答案1

我得出的结论是,我的 btrfs fs 树弄乱了,将来btrfsck disk可以清理掉。

现在你陷入困境:

root@v7:/srv# btrfs-find-root disk
Super think's the tree root is at 29360128, chunk root 20971520
Found tree root at 29360128
root@v7:/srv# btrfs-restore -t 29360120 disk /mnt/

相关内容