无法删除文件:“结构需要清理”

Rot*_*eti 38 filesystems ubuntu ext4 rm files

我有一个通过 LUKS 加密的外部硬盘驱动器。它包含一个 ext4 fs。

我刚刚从 rsync 收到一个错误,用于位于此驱动器上的文件:

rsync: readlink_stat("/home/some/dir/items.json") failed: Structure needs cleaning (117)
Run Code Online (Sandbox Code Playgroud)

如果我尝试删除该文件,则会出现相同的错误:

rm /home/some/dir/items.json
rm: cannot remove ‘//home/some/dir/items.json’: Structure needs cleaning
Run Code Online (Sandbox Code Playgroud)

有谁知道我可以做些什么来删除文件并修复驱动器/文件系统的相关问题(如果有的话)?

Dep*_*iel 34

这强烈表明文件系统损坏。您应该卸载,对磁盘进行扇区级备份,然后运行 ​​e2fsck 以查看发生了什么。如果有重大损坏,您可能会很高兴您在让 e2fsck 篡改数据之前进行了扇区级备份。

  • 我强烈建议人们使用像`gparted` 这样的GUI 来做到这一点。Gparted 仍然包装 e2fsck(在检查分区的情况下),但图形界面使选择合适的硬盘变得更加容易,并确保您使用正确的参数运行这些工具。使用错误的参数可能会导致数据严重丢失! (3认同)

Vic*_*art 8

如果它对任何人有帮助,我也有类似的问题(rsync/rsnapshot 备份,在受影响的文件上)。我在这里发布了我的问题/解决方案:

https://ubuntuforums.org/showthread.php?t=2348768&p=13627299#post13627299

概括:

arch linux x86_64 系统上的 rsnapshot (rsync) 备份错误;一个损坏的、嵌套很深的文件抛出了该错误,当我尝试删除该文件时也显示:

sudo rm -fR hourly.5/

rm: cannot remove 'hourly.5/snapshot_root/mnt/Vancouver/temp/temp - old/temp - 09 (Dec 07, 2014 - Sep 02, 2015)/a_OLD-gmail/victoria.a.stuart@gmail.com/[Gmail]/LINUX/rsync, rsnapshot; Other backups/19.bak': Structure needs cleaning
Run Code Online (Sandbox Code Playgroud)

这是问题所在:

cd mnt/Vancouver/temp/temp\ -\ old/temp\ -\ 09\ \(Dec\ 07\,\ 2014\ -\ Sep\ 02\,\ 2015\)/a_OLD-gmail/victoria.a.stuart@gmail.com/\[Gmail\]/LINUX/rsync\,\ rsnapshot\;\ Other\ backups/

ls -l

ls: cannot access '19.bak': Structure needs cleaning
total 0
-????????? ? ? ? ?  ? 19.bak        ## << THAT IS THE PROBLEM!!
Run Code Online (Sandbox Code Playgroud)

[另见:https : //www.reddit.com/r/linuxquestions/comments/4b47r2/has_anyone_ever_gotten_structure_needs_cleaning/ ]

我的备份驱动器是 /dev/sda1。

sudo umount /dev/sda1

sudo fsck.ext4 /dev/sda1  ## << accepted suggested fixes
Run Code Online (Sandbox Code Playgroud)

重新启动:一切似乎都很好。进入备份驱动器,删除了那个有问题的文件:

/mnt/Backups/rsnapshot_backups/hourly.5/snapshot_root/mnt/Vancouver/temp/temp - old/temp - 09 (Dec 07, 2014 - Sep 02, 2015)/a_OLD-gmail/victoria.a.stuart@gmail.com/[Gmail]/LINUX/rsync, rsnapshot; Other backups/19.bak
Run Code Online (Sandbox Code Playgroud)

QED?!

[更新:是的;有效:我的备份再次正常运行!:-)]