linux – 在fs崩溃并运行fsck之后,一些文件被恢复但是找不到丢失的文件?
作者:互联网
我在外部硬盘驱动器分区sdb4上有一个I / O错误(它通常的挂载点是/ run / media / yan / data).
分区没有响应,无法访问并拒绝卸载.我不知道该怎么办但拔下磁盘并重新插上它.之后我的fs出错,所以我运行了fsck:
sudo e2fsck /dev/sdb4 -y -v
它要求许多修复(数千),但由于数据在该磁盘上不重要,我用-y运行它.
data contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
# Fixed invalid inode numbers, incorrect filetypes, cleared links, deleted/unused inodes
Pass 3: Checking directory connectivity
# Connected unconnected directory inodes to /lost+found
Pass 4: Checking reference counts
#Fix inodes ref count, connected unattached inode to /lost+found
Pass 5: Checking group summary information
# Fix block bitmap differences, blocks count wrong for group
# Fix inode bitmap differences, directories count wrong for group, free inodes count wrong for group
data: ***** FILE SYSTEM WAS MODIFIED *****
72955 inodes used (0.14%, out of 51200000)
2390 non-contiguous files (3.3%)
17 non-contiguous directories (0.0%)
# of inodes with ind/dind/tind blocks: 0/0/0
Extent depth histogram: 72264/636/1
186984621 blocks used (91.30%, out of 204800000)
0 bad blocks
34 large files
70447 regular files
2453 directories
0 character device files
0 block device files
0 fifos
4294966642 links
46 symbolic links (46 fast symbolic links)
0 sockets
------------
71063 files
因此,如果我理解正确,fsck设法挽救70k文件,因此大多数文件因为我在该磁盘上有75-80k文件.问题是只有20k文件出现在’/ run / media / yan / data / lost found’中,而整个分区上只有24k.
[yan@machine ~]$find /run/media/yan/data/lost+found | wc -l
19786
[yan@machine ~]$find /run/media/yan/data | wc -l
23691
我重新fsck,但他告诉我分区是明确的(并有74k文件?)
[yan@machine ~]$sudo fsck /dev/sdb4
fsck from util-linux 2.28
e2fsck 1.42.13 (17-May-2015)
data: clean, 74200/51200000 files, 186685980/204800000 blocks[/cpp]
根据df和du我也有非常不同的磁盘使用量(我知道应该有区别,但这里似乎太大而不正常):
[yan@machine ~]$df -h /run/media/yan/data
Filesystem Size Used Avail Use% Mounted on
/dev/sdb4 769G 700G 31G 96% /run/media/yan/data
[yan@machine ~]$du -sh /run/media/yan/data
586G /run/media/yan/data
我猜测仍有无法访问的恢复数据.
我的问题是:
1)fsck恢复的文件是否可能不会丢失?在那种情况下,他们在哪里?
2)有没有办法找回那些丢失的文件?
3)如果没有,我如何释放这个空间?
编辑:
我在sourcejedi的推荐上尝试了更新版本的e2fsck:
[yan@machine build]$sudo ./e2fsck/e2fsck -f /dev/sdb4
e2fsck 1.43.3 (04-Sep-2016)
Pass 1: Checking inodes, blocks, and sizes
Inode 40501578 extent tree (at level 2) could be narrower. Fix<y>? yes
Pass 1E: Optimizing extent trees
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
data: ***** FILE SYSTEM WAS MODIFIED *****
data: 74200/51200000 files (3.2% non-contiguous), 186685964/204800000 blocks
它没有做太多,丢失发现仍然具有相同的文件数和大小.
解决方法:
我还注意到链接数非常可疑(接近2 ^ 32).
你可以尝试更新的e2fsck,和/或报告错误.这肯定是一个错误.
使用photorec扫描设备/分区可能会恢复更多文件,其中支持格式并且它们是连续的.由于您的FS已满,许多文件不是连续的. photorec不会恢复文件名或目录. (例如,如果它们是mp3,你可以使用类似picard的东西来应用mp3元数据中的文件名,即ID3标签).注意photorec需要另一个文件系统上的可用空间,以恢复所有文件.
标签:linux,fsck,data-recovery,e2fsck 来源: https://codeday.me/bug/20190813/1650121.html