簡介
Linux技巧:使用Fsck命令修復損壞的分區
輸入Root密碼登錄後採用:fsck -t ext3 -r /usr/local 修復
fsck的命令的幾個使用方法
指令:fsck
使用許可權 : 超級使用者 root
使用方式 : fsck [-sACVRP] [-t fstype] [–] [fsck-options] filesys […]
說明 : 檢查與修復 Linux 檔案系統,可以同時檢查一個或多個 Linux 檔案系統
參數
filesys : 磁碟設備名稱(eg./dev/sda1),掛載(mount)點 (eg. / 或 /usr)
-t : 給定檔案系統的型式,若在 /etc/fstab 中已有定義或 kernel 本身已支援的則不需加上此參數
-s : 依序一個一個地執行 fsck 的指令來檢查
-A : 對/etc/fstab 中所有列出來的 分區(partition)做檢查
-C : 顯示完整的檢查進度
-p : 同時有 -A 條件時,同時有多個 fsck 的檢查一起執行
-R : 同時有 -A 條件時,省略 / 不檢查
-V : 詳細顯示模式
-a : 如果檢查有錯則自動修復
-r : 如果檢查有錯則由使用者回答是否修復
-y : 選項指定檢測每個檔案是自動輸入yes,在不確定那些是不正常的時候,可以執行 # fsck -y 全部檢查修復。
例子 :
檢查 msdos 檔案系統的 /dev/hda5 是否正常,如果有異常便自動修復 :fsck -t msdos -a /dev/hda5
注意 :
此指令可與 /etc/fstab 相互參考操作來加以了解。
簡介與套用
The system utility fsck (for "file system check" or "file system consistency check") is a tool for checking the consistency of a file system in the Unix system and clones thereof.
Generally, fsck is run automatically at boot time when the system detects that a file system is in an inconsistent state, indicating a non-graceful shutdown, such as a crash or power loss. Typically, fsck utilities provide options for either interactively repairing damaged file systems (the user must decide how to fix specific problems), automatically deciding how to fix specific problems (so the user doesn't have to answer any questions), or reviewing the problems that need to be resolved on a file system without actually fixing them.
Fsck can also be run manually by the system administrator if there is believed to be a problem with the file system. However, running fsck on a mounted file system can potentially cause severe data corruption/loss.
A journaling file system is designed such that tools such as fsck do not need to be run as often. The UFS2 Filesystem in FreeBSD has background fsck, so it is usually not necessary to wait for fsck to finish before accessing the disk.
The Microsoft equivalent programs are scandisk and chkdsk. In DOS, chkdsk was used to check file system integrity, but later versions also featured a tool called scandisk for checking disk surface for bad sectors. Windows 95, Windows 98 and Windows Me featured a version of scandisk which ran natively in the Windows environment. The Windows NT series, including NT 4, Windows 2000, and Windows XP all use a modern, updated version of chkdsk which performs both disk surface and file system scanning, though its disk-surface check is less thorough than scandisk's.
Use as profanity
Before the rise of journaling file systems, it was not uncommon for an improperly shut-down Unix system's file system to develop a corrupted superblock. This possibly serious problem could only be resolved by running fsck, which could take anywhere from a few seconds to hours, depending on the volume's size. Because of the severity of fsck not being able to resolve this error, the terms "fsck" and "fscked" have come into use among Unix system administrators as a minced oath. When one is told "Go fsck yourself!" the meaning implied is to "go away, analyze yourself, and fix your problems", mirroring fsck's primary function.
It is unclear whether this usage was cause or effect, as it has been anecdotally reported that Dennis Ritchie has claimed "The second letter was originally different." [1]
Pronunciation
Like many computer jargon terms without vowels, fsck is essentially unpronounceable in most languages and so people are forced to improvise when speaking it aloud. It can be pronounced "F-S-C-K," "F-S-check," "fisk," "fizik," "fuss-uck," "fizz-uck," "fozz-uck," "F-sick," "F-suck" (associated with how long it takes to run [2]), "F-sek," or "fusk." Some prefer to just pronounce it as "fuck".
References
^ Google USENET archive of a 1998 post to alt.sysadmin.recovery
^ Example Google Groups post
External links
man fsck
Checking and Repairing File system with fsck
Jargon File entry: fscking
The many faces of fsck