Cannot remove : Input/output error

在一个ext3的根文件系统,里面有个临时文件,删除的时候报错:

$ sudo rm -f .rc.local.swp 
rm: cannot remove ‘.rc.local.swp’: Input/output error
ls的时候也报错:

$ ls -la
ls: cannot access .rc.local.swp: Input/output error
total 11
drwxr-xr-x  3 root    root    1024 Sep 12 23:20 .
drwxrwxr-x 18 charles charles 1024 Sep  8 01:05 ..
-rw-r--r--  1 root    root     980 Jan  2  2014 bootchartd.conf
-rw-r--r--  1 root    root     293 Sep 12 23:15 fstab
-rw-r--r--  1 root    root      44 Dec 16  2013 group
drwxr-xr-x  2 root    root    1024 Sep 12 23:05 init.d
-rw-r--r--  1 root    root     153 Dec 16  2013 inittab
-rw-r--r--  1 root    root     118 Dec 16  2013 passwd
-rw-r--r--  1 root    root     128 Dec 22  2013 profile
-rwxr-xr-x  1 root    root     502 Sep 12 23:20 rc.local
-?????????  ? ?       ?          ?            ? .rc.local.swp
解决方法是,使用 fsck 修复文件系统:

$ fsck.ext3  rootfs.img 
e2fsck 1.42.9 (4-Feb-2014)
rootfs.img contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Entry '.rc.local.swp' in /etc (119889) has deleted/unused inode 119892.  Clear? yes
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences:  -7170 -(485381--485388) -(488452--488455)
Fix? yes
Free blocks count wrong for group #0 (7655, counted=7656).
Fix? yes
Free blocks count wrong for group #59 (7896, counted=7908).
Fix? yes
Free blocks count wrong (438258, counted=438271).
Fix? yes
Inode bitmap differences:  -119892
Fix? yes
Free inodes count wrong for group #59 (2020, counted=2021).
Fix? yes
Free inodes count wrong (127446, counted=127447).
Fix? yes

rootfs.img: ***** FILE SYSTEM WAS MODIFIED *****
rootfs.img: 569/128016 files (2.6% non-contiguous), 73729/512000 blocks

之后,重新 mount 文件系统,发现那个文件已经被删除了。

你可能感兴趣的:(Linux)