Gri*_*ief 10 permissions ext4 fsck ownership data-corruption
我怎样才能删除这个目录?我做了fsck
,它发现了一些垃圾,我查看了这些文件,没有什么重要的东西。所以我试图删除内容,/lost+found
除了这个奇怪的目录外,一切都消失了。我认为将它放在/tmp
(我可以在整个卷上移动该目录)将在下次重新启动时将其擦除,但在重新启动和另一个fsck
.
由于问题似乎是低级别的,并且使用所有权和权限还不够,我已经让您能够自己重现该问题。享受!
dd if=/dev/sda1 of=/files/broken.iso
;我制作了一个 15MB 的存档,其中的图像约为 1.2GB。您可以使用以下命令下载并使用它:
cd /tmp
wget https://dl.dropboxusercontent.com/u/22701362/broken.tar.xz
tar xvf broken.tar.xz
mkdir test
sudo mount broken.iso test
cd test
Run Code Online (Sandbox Code Playgroud)
将有两个目录(在创建该映像期间,我的磁盘上似乎有两个这样的目录):
/tmp/test> tree
.
??? 1
? ??? plexus-component-annotations-1.5.5.jar.sha1 [error opening dir]
??? 2
??? #1589030 [error opening dir]
4 directories, 0 files
Run Code Online (Sandbox Code Playgroud)
删除这两个目录祝你好运:
/tmp/test> sudo rm -rf *
rm: cannot remove '1/plexus-component-annotations-1.5.5.jar.sha1': Operation not permitted
rm: cannot remove '2/#1589030': Operation not permitted
/tmp/test> sudo chown -R root:root *
chown: changing ownership of '1/plexus-component-annotations-1.5.5.jar.sha1': Operation not permitted
chown: cannot read directory '2/#1589030': Permission denied
/tmp/test> sudo chmod -R 777 *
chmod: changing permissions of '1/plexus-component-annotations-1.5.5.jar.sha1': Operation not permitted
chmod: changing permissions of '2/#1589030': Operation not permitted
chmod: cannot read directory '2/#1589030': Permission denied
Run Code Online (Sandbox Code Playgroud)
在 ext 文件系统的情况下,一种可能性是不可变标志。查看lsattr
命令的输出。如果i
存在,可以将其删除chattr -i filename
不能修改具有“i”属性的文件:不能删除或重命名它,不能创建指向该文件的链接,也不能将数据写入该文件。只有超级用户或拥有 CAP_LINUX_IMMUTABLE 能力的进程才能设置或清除此属性。
在这种情况下,还有其他事情发生
这似乎有效,
> lsattr 1
-----a---------- 1/plexus-component-annotations-1.5.5.jar.sha1
> rmdir 1/plexus-component-annotations-1.5.5.jar.sha1
rmdir: failed to remove '1/plexus-component-annotations-1.5.5.jar.sha1': Operation not permitted
> chattr -a 1/plexus-component-annotations-1.5.5.jar.sha1
> rmdir 1/plexus-component-annotations-1.5.5.jar.sha1
> lsattr 2
---D-ad--j--T--- 2/#1589030
> chattr -D -a -d -j -T 2/\#1589030
> rmdir 2/\#1589030
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5044 次 |
最近记录: |