Fsck

e2fsck 和 fsck 有什麼區別,我應該使用哪一個?

  • January 18, 2015

執行 dmesg 時收到此錯誤消息

EXT3-fs (sdd1): using internal journal
EXT3-fs (sdd1): mounted filesystem with ordered data mode
EXT4-fs (sda1): warning: mounting fs with errors, running e2fsck is recommended
EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts:
EXT4-fs (sdb1): warning: maximal mount count reached, running e2fsck is recommended
EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts:
EXT4-fs (sdc1): warning: maximal mount count reached, running e2fsck is recommended
EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts:
Adding 4194296k swap on /dev/sdd2.  Priority:-1 extents:1 across:4194296k SSD
kjournald starting.  Commit interval 5 seconds
EXT3-fs (loop0): warning: maximal mount count reached, running e2fsck is recommended
EXT3-fs (loop0): using internal journal

sdd 似乎執行良好。那是主分區。sda 到 sdc 不起作用。我應該 umount 和 fo fsck 嗎?但是我應該使用哪個 fsck?e2fsck? e4fsck? 哪一個?我在這裡使用 ext4。

我不知道loop0是什麼。

看來系統設置的很差。EXT3-fs (loop0): 以有序數據模式掛載的文件系統

我聽說我可以做 shutdown -rf 。有人已經這樣做了。系統重新上線,但我仍然收到此消息。是什麼賦予了?

fsck是此工具的原始名稱。當新的文件系統問世時,他們需要為每個系統提供特定的工具。因此fsck,只需充目前端,並將呼叫適當的文件系統 *fsck 來執行它自己無法執行的操作。

摘自 fsck 手冊頁

fs 特定選項

    Options which are not understood by fsck are passed to the 
    filesystem-specific checker.  These arguments must  not
    take  arguments,  as  there is no way for fsck to be able to 
    properly guess which arguments take options and which don't.

    Options and arguments which follow the -- are treated as file 
    system-specific options to be  passed  to  the  file
    system-specific checker.

    Please note that fsck is not designed to pass arbitrarily 
    complicated options to filesystem-specific checkers.  If
    you're doing something complicated, please just execute the 
    filesystem-specific checker  directly.   If  you  pass
    fsck  some horribly complicated option and arguments, and it 
    doesn't do what you expect, don't bother reporting it
    as a bug.  You're almost certainly doing something that you 
    shouldn't be doing with fsck.

大多數正常的操作都可以通過fsck.

其他工具?

快速瀏覽一下我的 Fedora 14 系統會顯示以下 fsck* 工具:

$ fsck
fsck          fsck.ext2     fsck.ext4     fsck.msdos    fsck.vfat     
fsck.cramfs   fsck.ext3     fsck.ext4dev  fsck.ntfs     fsck.xfs

locate命令顯示更多:

$ locate fsck|grep "^/sbin"
/sbin/dosfsck
/sbin/e2fsck
/sbin/fsck
/sbin/fsck.cramfs
/sbin/fsck.ext2
/sbin/fsck.ext3
/sbin/fsck.ext4
/sbin/fsck.ext4dev
/sbin/fsck.msdos
/sbin/fsck.ntfs
/sbin/fsck.vfat
/sbin/fsck.xfs

在這兩個列表之間,您可以看到幾乎每種文件系統類型都有自己的 fsck* 工具。一些工具是多用途的,例如dos2fsck

$ ls -l /sbin/|grep fsck | grep dos
-rwxr-xr-x  1 root root   54424 Apr  5  2011 dosfsck
lrwxrwxrwx  1 root root       7 Aug  3  2011 fsck.msdos -> dosfsck
lrwxrwxrwx  1 root root       7 Aug  3  2011 fsck.vfat -> dosfsck

參考

引用自:https://unix.stackexchange.com/questions/87415