up | Inhaltsverzeichniss | Kommentar

Manual page for FSCK(8)

fsck - file system consistency check and interactive repair


/usr/etc/fsck -p [ -f ] [ -w ] [ -l number ] [ filesystem... ]

/usr/etc/fsck [ -b block# ] [ -w ] [ -y ] [ -n ] [ -c ] [ filesystem... ]


fsck is a program that checks and repairs file system consistency. It can operate in two modes, ``preen'' and interactive. ``Preen'' is a non-interactive mode which only repairs a subset of file system inconsistencies. The interactive mode allows users to audit and repair any inconsistencies.

``Preen'' Mode

With the -p option, fsck audits and automatically repairs (``preens'') inconsistencies on a set of file systems. If a list of file systems is specified on the command line, fsck sequentially checks each one; otherwise, fsck reads the table /etc/fstab to determine the file systems to check. It then inspects disks in parallel, taking advantage of I/O overlap to check the file systems quickly. The number of disks checked in parallel can be limited using the -l option. This helps systems that do not have sufficient memory to run enough fscks to check all disks in parallel. Preen mode is normally used in the /etc/rc script during automatic reboot.

Each file system's super block clean flag is examined and only those file systems not marked clean or stable are checked. A message identifying the name of the device and its file system's state is printed if the clean flag indicates that checking is not necessary. If the -f (force) option is in effect, fsck checks the file system regardless of the state of its clean flag.

Only partitions marked in /etc/fstab with a file system type of ``4.2'' and a non-zero pass number are checked. If the force option is in effect, file systems with pass number 1 (typically /, /usr, and /usr/kvm) are checked one at a time. When pass 1 completes, all remaining file systems are checked, running one process per disk drive. If the force option is not in effect (the default case), all file systems with non-zero pass numbers are checked in as parallel a manner as possible.

fsck corrects innocuous inconsistencies such as: unreferenced inodes, too-large link counts in inodes, missing blocks in the free list, blocks appearing in the free list and also in files, or incorrect counts in the super block, automatically. It displays a message for each inconsistency corrected that identifies the nature of, and file system on which, the correction is to take place. After successfully correcting a file system, fsck sets the file system's super block clean flag to stable, prints the number of files on that file system, the number of used and free blocks, and the percentage of fragmentation.

If fsck encounters other inconsistencies that it cannot fix automatically, it does not change the state of the super block clean flag and exits with an abnormal return status (and the reboot fails). A list of file systems containing such uncorrectable inconsistencies is printed just before fsck exits.

If sent a QUIT signal while preening the file systems listed in /etc/fstab, fsck finishes the file system checks, then exit with an abnormal return status and the automatic reboot fails. This is useful when you wish to finish the file system checks, but do not want the machine to come up multiuser.

Interactive Mode

Without the -p option, fsck audits and interactively repairs inconsistent conditions on file systems. File systems are checked regardless of the state of their clean flag. In this case, fsck asks for confirmation before attempting any corrections. Inconsistencies other than those mentioned above can often result in some loss of data. The amount and severity of data lost can be determined from the diagnostic output.

The default action for each correction is to wait for the operator to respond either yes or no. If the operator does not have write permission on the file system, fsck defaults to a -n (no corrections) action.

If no file systems are given to fsck then a default list of file systems is read from the file /etc/fstab.

Inconsistencies checked in order are as follows:

Orphaned files and directories (allocated but unreferenced) are, with the operator's concurrence, reconnected by placing them in the lost+found directory. The name assigned is the inode number. If the lost+found directory does not exist, it is created. If there is insufficient space its size is increased.

A file system may be specified by giving the name of the cooked or raw device on which it resides, or by giving the name of its mount point. If the latter is given, fsck finds the name of the device on which the file system resides by looking in /etc/fstab.


Use the block specified immediately after the flag as the super block for the file system. Block 32 is always an alternate super block.
Force checking of file systems regardless of the state of their super block clean flag .
-l number
Limits the number of fscks that are run concurrently in preen mode. (See -p.)
Check writable file systems only.
Assume a yes response to all questions asked by fsck; this should be used with extreme caution, as it is a free license to continue, even after severe problems are encountered.
Assume a no response to all questions asked by fsck; do not open the file system for writing.
Audit and automatically repair inconsistencies on file systems whose state is either active or unknown. If no other options are specified, fsck inspects file systems listed in /etc/fstab in parallel, simultaneously checking one file system per disk. If file systems are specified on the command line, inspection is sequential.
If the file system is in the old (static table) format, convert it to the new (dynamic table) format. If the file system is in the new format, convert it to the old format provided the old format can support the file system configuration. In interactive mode, fsck lists the direction the conversion is to be made and asks whether the conversion should be done. If a negative answer is given, no further operations are done on the filesystem. In preen mode, the direction of the conversion is listed and done if possible without user interaction. Conversion in preen mode is best used when all the file systems are being converted at once. The format of a file system can be determined from the first line of output from dumpfs.8


default list of file systems to check
list of mounted file systems


Either no errors detected or all errors were corrected.
A QUIT signal was caught while preening the file systems listed in /etc/fstab; abort the reboot procedure.
Errors on the root or a mounted file system were corrected. The system must be rebooted.
Some uncorrected errors exist on one or more of the file systems checked, there was a syntax error, or some other operational error occurred.
An INTERRUPT signal was caught during processing.


The diagnostics produced by fsck are fully enumerated and explained in the System and Network Administration Manual with the following additions.

After checking a file system in non-preening mode, the question:

is asked if the file system's clean state is wrong. A ``yes'' response instructs fsck to reset this state to active if there are inconsistencies, or to stable if there are no uncorrected inconsistencies. A ``no'' response instructs fsck to leave the existing state unchanged.
When fsck is run in preen mode, the file systems that need additional attention are normally scrolled off the screen. With the enhanced version of fsck these file systems listed as fsck exits. This provides the user with a list of the the file systems that require attention. An example follows:

        /dev/rsd6a (/sd6a), /dev/rsd6b (/sd6b)
        Reboot failed...help!


Because super block consistency checks are not made when the -b option is used, it is recommended that -b be augumented with the -n option to verify fsck actions. Once you are satisfied that the fsck actions are correct, then remove the -n.


fs.5 fstab.5 dumpfs.8 newfs.8 mkfs.8 panic.8s reboot.8 rexecd.8c ypserv.8

System and Network Administration

index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).

Last modified 21/April/97