一天一个 Linux 命令(28):fsck 命令
生活随笔
收集整理的這篇文章主要介紹了
一天一个 Linux 命令(28):fsck 命令
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
本文為joshua317原創(chuàng)文章,轉(zhuǎn)載請注明:轉(zhuǎn)載自joshua317博客?一天一個(gè) Linux 命令(28):fsck 命令 - joshua317的博客
一、簡介
Linux下的fsck(英文全拼:file system check)命令用于檢查與修復(fù) Linux 文件系統(tǒng)的一些錯(cuò)誤信息,可以同時(shí)檢查一個(gè)或多個(gè) Linux 文件系統(tǒng)。若系統(tǒng)掉電或磁盤發(fā)生問題,可利用fsck命令對文件系統(tǒng)進(jìn)行檢查。
二、格式說明
fsck [options]...[filesystem]... fsck [參數(shù)] [文件系統(tǒng)]Usage: fsck.ext4 [-panyrcdfvtDFV] [-b superblock] [-B blocksize][-I inode_buffer_blocks] [-P process_inode_size][-l|-L bad_blocks_file] [-C fd] [-j external_journal][-E extended-options] deviceEmergency help:-p Automatic repair (no questions)-n Make no changes to the filesystem-y Assume "yes" to all questions-c Check for bad blocks and add them to the badblock list-f Force checking even if filesystem is marked clean-v Be verbose-b superblock Use alternative superblock-B blocksize Force blocksize when looking for superblock-j external_journal Set location of the external journal-l bad_blocks_file Add to badblocks list-L bad_blocks_file Set badblocks list三、選項(xiàng)說明
-a 自動(dòng)修復(fù)文件系統(tǒng),不詢問任何問題 -A 依照/etc/fstab配置文件的內(nèi)容,檢查文件內(nèi)所列的全部文件系統(tǒng) -c 檢查壞塊,并將它們添加到壞塊列表 -C 顯示完整的檢查進(jìn)度 -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)不予檢查 -s 依序一個(gè)一個(gè)地執(zhí)行 fsck 的指令來檢查 -t 指定要檢查的文件系統(tǒng)類型 -T 執(zhí)行fsck指令時(shí),不顯示標(biāo)題信息 -y 選項(xiàng)指定檢測每個(gè)文件是自動(dòng)輸入yes,在不確定那些是不正常的時(shí)候,可以執(zhí)行 # fsck -y 全部檢查修復(fù)。 -V 顯示指令執(zhí)行過程四、命令功能
檢查并修復(fù)Linux文件系統(tǒng)。
五、常見用法
5.1 檢查 ext4 文件系統(tǒng)的 /dev/vda1 是否正常,如果有異常便自動(dòng)修復(fù) :
#檢查磁盤分區(qū)/dev/vda1的文件系統(tǒng)。 fsck /dev/vda1#自動(dòng)修復(fù)文件系統(tǒng),不詢問任何問題 fsck -t ext4 -a /dev/vda1#采用互動(dòng)模式,在執(zhí)行修復(fù)時(shí)詢問問題,讓用戶得以確認(rèn)并決定處理方式 fsck -t ext4 -r /dev/vda1#強(qiáng)制檢查磁盤分區(qū)/dev/vda1的文件系統(tǒng) fsck -f /dev/vda1#檢查和修復(fù)磁盤分區(qū)/dev/vda1的文件系統(tǒng),在執(zhí)行修復(fù)時(shí)進(jìn)行詢問,讓用戶決定處理方式,顯示詳細(xì)修復(fù)過程 fsck -rV -t ext4 /dev/vda1#檢查磁盤分區(qū)/dev/vda1的文件系統(tǒng),并顯示完整的檢查進(jìn)度。 fsck -C -t ext4 /dev/vda1本文為joshua317原創(chuàng)文章,轉(zhuǎn)載請注明:轉(zhuǎn)載自joshua317博客?一天一個(gè) Linux 命令(28):fsck 命令 - joshua317的博客
總結(jié)
以上是生活随笔為你收集整理的一天一个 Linux 命令(28):fsck 命令的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 树冠体积计算之体元累加法
- 下一篇: linux基本功之fsck命令详解