重新启动时, fsck.ext4

分享于 

3分钟阅读

ubuntu

  繁體

问题

当我运行fsck.ext4 -n /dev/sda5时,它告诉我有错误

我尝试过:

 
touch /forcefsck



也尝试了:

 
shutdown -rF now



重启后我仍然看到错误。


root@server:~# fsck.ext4 -n /dev/sda5


e2fsck 1.41.11 (14-Mar-2010)


Warning! /dev/sda5 is mounted.


Warning: skipping journal recovery because doing a read-only filesystem check.


/dev/sda5 contains a file system with errors, check forced.


Pass 1: Checking inodes, blocks, and sizes


Pass 2: Checking directory structure


Pass 3: Checking directory connectivity


Pass 4: Checking reference counts


Pass 5: Checking group summary information


Free blocks count wrong (1849368, counted=1948909).


Fix? no



Free inodes count wrong (545504, counted=552134).


Fix? no



/dev/sda5: ********** WARNING: Filesystem still has errors **********



/dev/sda5: 116752/662256 files (0.2% non-contiguous), 795324/2644692 blocks




答案1


e2fsck -cy /dev/sda5




答案2

但是,你不能保证fsck会修复它找到的东西,你需要编辑文件/etc/default/rcS.文件,末尾有一行:

 
FSCKFIX=no



这需要修改如下:

 
FSCKFIX=yes




答案3


sudo touch /forcefsck


sudo reboot




答案4

无法在/上强制fsck,因为分区正在使用,尝试从其他分区或live cd运行检查。


答案5

可以通过以下方式自动完成修订:


Tune2fs -c 5 -i 10 / dev / sda1



-c是运行fsck之前挂载的最大数量,-i是运行fsck之前的最大天数。


答案6

单独touch /forcefsck并不能确保系统在下次引导时运行fsck,需要运行:


sudo tune2fs -c 1 /dev/<my partition>



比如,


sudo tune2fs -c 1 /dev/sda1





ext  for  EXT4  fsck  fsc