根据我有一个损坏的文件 btrfs
BTRFS info (device sdb1): csum failed ino 367 off 310013952 csum 1601485211 expected csum 3692975992
Run Code Online (Sandbox Code Playgroud)
我假设 ino 367 表示 inode 367,所以我可以使用 find 并尝试恢复文件。然而find /path -inum 367
什么也没找到。有谁知道如何找到损坏的文件?
例子:
sudo btrfs inspect-internal inode-resolve 15380 /home
Run Code Online (Sandbox Code Playgroud)
inode-resolve [-v] <ino> <path>
(needs root privileges)
resolve paths to all files with given inode number ino in a given
subvolume at path, ie. all hardlinks
Options
-v
verbose mode, print count of returned paths and ioctl()
return value
Run Code Online (Sandbox Code Playgroud)
我不确定为什么 find 命令对你不起作用。ino#367 可能被删除了吗?对我来说,两者find
似乎btrfs-debug-tree
都工作得很好。
$ find /btrfs/ -inum 257
/btrfs/100kbfile.txt
$ ls -li /btrfs/100kbfile.txt
257 -rw-r--r--. 1 root root 102400 Nov 25 21:07 /btrfs/100kbfile.txt
Run Code Online (Sandbox Code Playgroud)
您还可以尝试使用“btrfs-debug-tree”和 grep 作为 objectid。
./btrfs-debug-tree /btrfs/partition | grep -A2 257
Run Code Online (Sandbox Code Playgroud)
从输出中找到您的 inode/objectid。您可以看到name
与 objectid 257 关联的。
位置键 (257 INODE_ITEM 0) 类型 FILE
namelen 13 datalen 0 名称:100kbfile.txt