红联Linux门户
Linux帮助

报错Cannot remove : Input/output error的解决办法

发布时间:2016-02-17 15:46:06来源:linux网站作者:CaspianSea

在一个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 rootroot1024 Sep 12 23:20 . 
drwxrwxr-x 18 charles charles 1024 Sep  8 01:05 .. 
-rw-r--r--  1 rootroot 980 Jan  2  2014 bootchartd.conf 
-rw-r--r--  1 rootroot 293 Sep 12 23:15 fstab 
-rw-r--r--  1 rootroot  44 Dec 16  2013 group 
drwxr-xr-x  2 rootroot1024 Sep 12 23:05 init.d 
-rw-r--r--  1 rootroot 153 Dec 16  2013 inittab 
-rw-r--r--  1 rootroot 118 Dec 16  2013 passwd 
-rw-r--r--  1 rootroot 128 Dec 22  2013 profile 
-rwxr-xr-x  1 rootroot 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<y>? 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<y>? yes 
Free blocks count wrong for group #0 (7655, counted=7656). 
Fix<y>? yes 
Free blocks count wrong for group #59 (7896, counted=7908). 
Fix<y>? yes 
Free blocks count wrong (438258, counted=438271). 
Fix<y>? yes 
Inode bitmap differences:  -119892 
Fix<y>? yes 
Free inodes count wrong for group #59 (2020, counted=2021). 
Fix<y>? yes 
Free inodes count wrong (127446, counted=127447). 
Fix<y>? yes 

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

报错Cannot remove : Input/output error的解决办法

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


本文永久更新地址:http://www.linuxdiyf.com/linux/18154.html