fsck(
file system check)用来检查和维护不一致的
文件系统。若系统
掉电或磁盘发生问题,可利用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 : 显示完整的检查进度
-d : 打印出
e2fsck 的 debug 结果
-p : 同时有 -A 条件时,同时有多个 fsck 的检查一起执行
-R : 同时有 -A 条件时,省略 / 不检查
-a : 如果检查有错则自动修复
-r : 如果检查有错则由使用者回答是否修复
-y : 选项指定检测每个文件是自动输入yes,在不确定那些是不正常的时候,可以执行 # fsck -y 全部检查修复。
例子 :
检查 msdos 档案系统的 /dev/hda5 是否正常,如果有异常便自动修复 :fsck -t msdos -a /dev/hda5
注意 :
此指令可与 /etc/fstab 相互参考操作来加以了解。
简介与应用
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
It is unclear whether this usage was cause or effect, as it has been anecdotally reported that
Dennis Ritchie^
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