从 dd-ed btrfs 分区中检索文件

从 dd-ed btrfs 分区中检索文件

我已经 dd-ed 了一个 btrfs 分区(来自乔拉电话),按照最后的指示,保留一份安全副本(参见:注释梅尔旗鱼/备份设备维基页面,)。也许是错误的,在阅读了Btrfs 陷阱维基页面。

[更新] 我想从子卷中复制一些文件home。请注意,文件未被删除。当我挂载感兴趣的子卷时,我可以浏览目录并列出文件。但是,每次读取或复制的尝试都失败了。

[更新]将图像保存到空的 micro-SD 卡后dd(尝试查看复制文件失败,即cp: reading 'filename': Input/output error,是否是由于在http://superuser.com/a/793638/128768),作为 root,我这样做:

# list tree roots
btrfs restore -l /dev/sdc

tree key (EXTENT_TREE ROOT_ITEM 0) 46944256 level 2
tree key (DEV_TREE ROOT_ITEM 0) 35631104 level 0
tree key (FS_TREE ROOT_ITEM 0) 157016064 level 0
tree key (CSUM_TREE ROOT_ITEM 0) 82132992 level 2
tree key (QUOTA_TREE ROOT_ITEM 0) 67289088 level 0
tree key (UUID_TREE ROOT_ITEM 0) 32456704 level 0
tree key (259 ROOT_ITEM 0) 29503488 level 0
tree key (264 ROOT_ITEM 33) 116465664 level 2
tree key (265 ROOT_ITEM 34) 116400128 level 1
tree key (299 ROOT_ITEM 866702) 40960000 level 3
tree key (325 ROOT_ITEM 2361424) 119631872 level 2
tree key (327 ROOT_ITEM 2361546) 152805376 level 3
tree key (328 ROOT_ITEM 2361547) 84439040 level 2
tree key (DATA_RELOC_TREE ROOT_ITEM 0) 122241024 level 0

按照https://superuser.com/a/875265/128768, 我愿意:

# mount the card
mount /dev/sdc /mnt/ddjolla

# enter in
cd /mnt/ddjolla/

# then, list subvolumes
btrfs subvolume list .

ID 259 gen 10 top level 5 path @swap
ID 264 gen 2361991 top level 5 path factory-@
ID 265 gen 2361991 top level 5 path factory-@home
ID 299 gen 2362013 top level 5 path @_old
ID 325 gen 2361991 top level 299 path @_old/factory-@
ID 327 gen 2484920 top level 5 path @
ID 328 gen 2484927 top level 5 path @home

# set default subvolume to one from which to revert files
btrfs subvolume set-default 328 /mnt/ddjolla

# unmount
umount /mnt/blah

到目前为止看起来不错。目前,

# try to find root(s)
btrfs-find-root /dev/sdc

Superblock thinks the generation is 2484930
Superblock thinks the level is 1

正在进行的任何操作都太慢,消耗 CPU 资源并且没有进展的迹象。

我现在“发现”,我指向输出文件的 SD 卡的文件系统很可能dd是 FAT!(请参阅问答中的评论完整的手机备份指南https://together.jolla.com/questions/)这很可能是行不通的(对于大于 4GB 的文件),并且原始分区中的大部分数据都丢失了(显然大于 4GB)。是这样吗?

为了记录,这里还有一条信息

btrfs check /dev/sdc
Checking filesystem on /dev/sdc
UUID: 0f8a2490-53ed-4ff6-ba34-b81df3430387
checking extents
checking free space cache
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 46130921472
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 47204663296
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 49352146944
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 50425888768
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 51499630592
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 52573372416
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 53647114240
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 54720856064
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 55794597888
btrfs: csum mismatch on free space cache
failed to load free space cache for block group 56868339712
checking fs roots
checking csums
checking root refs
checking quota groups
Qgroup is already inconsistent before checking
Counts for qgroup id: 265 are different
our:        referenced 38080512 referenced compressed 38080512
disk:       referenced 38080512 referenced compressed 38080512
our:        exclusive 38002688 exclusive compressed 38002688
disk:       exclusive 4096 exclusive compressed 4096
diff:       exclusive 37998592 exclusive compressed 37998592
found 9357398016 bytes used err is 1
total csum bytes: 8866964
total tree bytes: 264663040
total fs tree bytes: 237322240
total extent tree bytes: 14561280
btree space waste bytes: 79581505
file data blocks allocated: 9901109248
 referenced 8732901376

有没有办法解决这个问题并btrfs restore -r ...按照参考答案中描述的方式进行操作?如果不是,而且很可能是这样,那么这也许可以作为一个有用的错误,以避免将来再发生类似的错误。

相关内容