|HP-UX Reference > F
fsck_hfs(1M)HP-UX 11i Version 3: February 2007
fsck_hfs: fsck — HFS file system consistency check and interactive repair
/usr/sbin/fsck [-F hfs] [-m] [-i] [-s] [-V] [-b blocknum] [special]...
/usr/sbin/fsck [-F hfs] [-c size] [-f] [-i] [-p|-P] [-V] [-s] [special]...
/usr/sbin/fsck [-F hfs] [-b blocknum] [-c size] [-f] [-i] [-n|-N|-y|-Y] [-q] [-s] [-V] [special]...
The fsck command audits and repairs inconsistent conditions for HFS file systems on mass storage device files identified by special. If the file system is consistent, the number of files on that file system and the number of used and free blocks are reported. If the file system is inconsistent, fsck provides a mechanism to fix these inconsistencies, depending on which form of the fsck command is used.
special represents a special device (for example, /dev/rdisk/disk8).
If the target device is a swap device, fsck does not continue to process. fsck also checks the target device to ensure a mounted file system is not being checked. If a mounted device is specified but the -f and -i options are omitted, fsck prompts the user for a response.
If the -p|-P option is used and special is not specified, fsck reads the pass numbers in /etc/fstab to determine which groups of disks to inspect in parallel, taking maximum advantage of I/O overlap to process the file systems as quickly as possible. The -p|-P option is normally used in the script /sbin/bcheckrc during automatic reboot.
Normally, the root file system is checked on pass 1, and other "root" (section 0) file systems on pass 2. Other small file systems are checked on separate passes (such as the section 4 file systems on pass 3 and the section 7 file systems on pass 4), and finally the large user file systems are checked on the last pass (for example, pass 5). A pass number of 0 in /etc/fstab causes a file system not to be checked. If the optional fields are not present on a line in /etc/fstab, fsck processes the file system on such lines sequentially after all eligible file systems with positive pass numbers have been processed.
The inconsistencies that fsck with the -p|-P option corrects are shown below. These are inconsistencies that are correctable without data loss. If it encounters other inconsistencies, it exits with an abnormal return status. For each corrected inconsistency, one or more lines are printed identifying the file system on which the correction will take place and the nature of the correction. Correctable inconsistencies are limited to the following:
The -P option operates in the same manner as the -p option except that cleanly unmounted file systems are not checked (see fsclean(1M)). This can greatly decrease the amount of time required to reboot a system that was brought down cleanly.
If the -p|-P option is not specified, the pass numbers are ignored and the file systems are checked interactively in the order they are listed in /etc/fstab.
Without the -p|-P option, fsck prompts for concurrence before each correction is attempted when the file system is inconsistent. It should be noted that some corrective actions result in a loss of data. The amount and severity of data loss can be determined from the diagnostic output. The default action for each consistency correction is to wait for the operator to respond yes or no. If the operator does not have write permission, fsck defaults to a -n action.
fsck recognizes the following options:
In all cases, fsck checks the following inconsistencies:
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. The only restriction is that the directory lost+found must have empty slots in which entries can be made. This is accomplished by copying a number of files to the directory, then removing them before fsck is executed.
Unreferenced continuation inodes are removed with the -p option, since they do not refer back to the primary inode. When a primary inode contains an invalid continuation inode number, the continuation inode number should be cleared (that is, set to 0). This is not done automatically (with the -p option), because access control list information may have been lost and should be corrected.
After fsck has checked and fixed the file system, it stores the correct fs_clean flag in the superblock if it is not already there. For a nonroot file system, FS_CLEAN is stored there. For the root file system, which is mounted at the time of the fsck, no changes are required to the superblock if no problems were found and FS_OK was already set.
Checking the raw device is almost always faster.
fsck returns the following values:
fsck should not be run on mounted file systems or on the root device. If you do run on mounted file systems, be sure the system is in single-user state (see shutdown(1M)).
The special case of the -c option, -c 0, will disable all internal caches, which will reduce memory usage but may impact performance.
The -F option, from prior releases, has been replaced by the -f option.
dumpfs(1M), fsck(1M), fsck_vxfs(1M), fsclean(1M), mkfs(1M), newfs(1M), shutdown(1M), fstab(4), acl(5), fs_wrapper(5), disk(7).