/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.
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.
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.
The diagnostics produced by fsck are fully enumerated and explained in the System and Network Administration Manual with the following additions.
CLEAN FLAG IN SUPERBLOCK IS WRONG; FIX?
. . . /dev/rsd6a: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. THE FOLLOWING FILE SYSTEMS HAD AN UNEXPECTED INCONSISTENCY: /dev/rsd6a (/sd6a), /dev/rsd6b (/sd6b) Reboot failed...help!
System and Network Administration
Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97