Linux fsck命令 – 檢查并修復(fù)Linux文件系統(tǒng)
fsck命令的英文全稱是“filesystem check”,即檢查文件系統(tǒng)的意思,常用于檢查并修復(fù)Linux文件系統(tǒng)的一些錯(cuò)誤信息,操作文件系統(tǒng)需要先備份重要數(shù)據(jù),以防丟失。
Linux fsck命令用于檢查并修復(fù)Linux文件系統(tǒng),可以同時(shí)檢查一個(gè)或多個(gè) Linux 文件系統(tǒng);若系統(tǒng)掉電或磁盤發(fā)生問題,可利用fsck命令對(duì)文件系統(tǒng)進(jìn)行檢查。
語法格式:fsck [參數(shù)] [文件系統(tǒng)]
常用參數(shù):
-a 自動(dòng)修復(fù)文件系統(tǒng),不詢問任何問題
-A 依照/etc/fstab配置文件的內(nèi)容,檢查文件內(nèi)所列的全部文件系統(tǒng)
-N 不執(zhí)行指令,僅列出實(shí)際執(zhí)行會(huì)進(jìn)行的動(dòng)作
-P 當(dāng)搭配”-A”參數(shù)使用時(shí),則會(huì)同時(shí)檢查所有的文件系統(tǒng)
-r 采用互動(dòng)模式,在執(zhí)行修復(fù)時(shí)詢問問題,讓用戶得以確認(rèn)并決定處理方式
-R 當(dāng)搭配”-A”參數(shù)使用時(shí),則會(huì)略過/目錄的文件系統(tǒng)不予檢查
-t 指定要檢查的文件系統(tǒng)類型
-T 執(zhí)行fsck指令時(shí),不顯示標(biāo)題信息
-V 顯示指令執(zhí)行過程
參考實(shí)例
修復(fù)壞的分區(qū)文件系統(tǒng):
[root@linuxcool ~]# fsck -t ext3 -r /usr/local
fsck from util-linux 2.23.2
e2fsck 1.42.9 (28-Dec-2013)
fsck.ext3: Is a directory while trying to open /usr/local
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193
/usr/local: status 8, rss 1232, real 0.020288, user 0.002022, sys 0.005354
顯示fsck系統(tǒng)安裝的版本號(hào):
[root@linuxcool ~]# fsck --version
fsck from util-linux 2.23.2
作者:大學(xué)生新聞網(wǎng) 來源:大學(xué)生新聞網(wǎng)
發(fā)布時(shí)間:2025-03-13 閱讀:
- Linux tftp命令 – 上傳及下載文件
- tftp命令來自于英文詞組”Trivial File Transfer Protocol“的縮寫,中文譯為簡(jiǎn)單文件傳輸協(xié)議,其功能是基于TFTP協(xié)議進(jìn)行的文件傳輸工
- 03-13 關(guān)注:3