66 lines
2.4 KiB
Plaintext
66 lines
2.4 KiB
Plaintext
|
|
|
|
|
|
|
|
|
|
Command: fsck, fsck1 - perform file system consistency check
|
|
Syntax: fsck [-aclmrs] [device] ...
|
|
Flags: -a Automatically repair inconsistencies
|
|
-c Check and list only the specified i-nodes
|
|
-l List the files and directories in the filesytem
|
|
-r Prompt user for repairs if inconsistencies are found
|
|
-s List the superblock of the file system
|
|
Examples: fsck /dev/hd4 # Check file system on /dev/hd4
|
|
fsck -a /dev/at0 # Automatically fix errors on
|
|
/dev/at0
|
|
fsck -l /dev/fd0 # List the contents of /dev/fd0
|
|
fsck -c 2 3 /dev/hd3 # Check and list /dev/hd3 i-nodes 2
|
|
& 3
|
|
|
|
Fsck performs consistency checks on the file systems which reside
|
|
on the specified devices. Fsck1 is an alternate version for use on
|
|
obsolete V1 file systems. When either the -a or -r flags are given, the
|
|
file system will be repaired if errors are found. Before running fsck
|
|
on a mounted file system, it must first be unmounted. Trying to repair
|
|
a mounted file system is dangerous and should not be attempted.
|
|
|
|
To repair the root file system (which cannot be unmounted), first
|
|
hit the F1 key to find the pid of the /etc/update process. Then become
|
|
superuser and send update signal 9 using kill. After doing this, hit F1
|
|
again to verify that /etc/update has vanished. Next run fsck and then
|
|
immediately reboot the computer, WITHOUT doing a sync.
|
|
|
|
This is the only situation in which you can (in fact, must) reboot
|
|
without doing a sync. Rebooting is needed because fsck repairs the disk
|
|
but does not affect the (possibly incorrect) information held in memory.
|
|
Doing a sync would force the (possibly incorrect) information from
|
|
memory back onto the disk, thus ruining the work done by fsck. By
|
|
rebooting immediately, memory is reloaded with correct information from
|
|
the disk. It is necessary to kill /etc/update before repairing the root
|
|
file system to prevent it from issuing sync calls while fsck is running.
|
|
Because /etc/update only affects mounted file systems (and the root),
|
|
when repairing a nonroot file system, unmounting it is sufficient; it is
|
|
not necessary to kill /etc/update.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|