FSCK(1M) — HP-UX
NAME
fsck − file system consistency check and interactive repair
SYNOPSIS
/etc/fsck −p [ file system ... ]
/etc/fsck −P [ file system ... ]
/etc/fsck [ −b block# ] [ −y ][ −n ][ −q ][ file system ... ]
DESCRIPTION
Fsck audits and interactively repairs inconsistent conditions for HP-UX file systems. 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 used.
Fsck checks a default set of file systems or the file systems specified in the command line. If file system is not specified, fsck reads the table in /etc/checklist, using the first field (special file name) to determine which file systems to check.
If the -p option is used without specifying a file system, fsck reads the specified pass numbers in /etc/checklist to inspect groups of disks in parallel, taking maximum advantage of I/O overlap to preen the file systems as quickly as possible. The -p option is normally used in the script /etc/bcheckrc during automatic reboot. Normally, the root file system will be checked on pass 1, and other “root” (“0” section) file systems on pass 2. Other small file systems are checked on separate passes (e.g. 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 (e.g. pass 5). A pass number of zero or a type which is neither "rw" nor "ro" in /etc/checklist causes a file system not to be checked. If the optional fields are not present on a line in /etc/checklist, or the pass number is -1, fsck will preen the file system on such lines sequentially after all eligible file systems with positive pass numbers have been preened.
Below are the inconsistencies that fsck with the −p option will correct; if it encounters other inconsistencies it exits with an abnormal return status. For each corrected inconsistency, one or more lines will be printed identifying the file system on which the correction will take place, and the nature of the correction. The inconsistencies that are corrected are limited to the following:
Unreferenced inodes
Unreferenced pipes and fifos
Link counts in inodes too large
Missing blocks in the free list
Blocks in the free list also in files
Counts in the super-block wrong.
The −P option operates in the same manner as the −p option except those file systems which were cleanly unmounted will not be checked (see fsclean(1M)). This can greatly decrease the amount of time required to reboot a system which was brought down cleanly.
Without the -p or -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 will result in a loss of data. The amount and severity of data lost may 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 will default to a −n action. The following options are interpreted by fsck.
−b Use the block specified immediately after the flag as the super block for the file system. An alternate super block will always be found at block ((SBSIZE + BBSIZE)/DEV_BSIZE), typically block 16. (DEV_BSIZE is defined in <sys/param.h>.)
−y Assume a yes response to all questions asked by fsck; this should be used with great caution as this is a free license to continue after essentially unlimited trouble has been encountered.
−n Assume a no response to all questions asked by fsck; do not open the file system for writing.
−q Quiet fsck. Do not print size-check messages in Phase 1. Unreferenced fifos will silently be removed. If fsck requires it, counts in the superblock and cylinder groups will be automatically fixed.
In all cases the inconsistencies checked by fsck are as follows:
1. Blocks claimed by more than one inode or the free list.
2. Blocks claimed by an inode or the free list outside the range of the file system.
3. Incorrect link counts.
4. Size checks:
Directory size not of proper format.
5. Bad inode format.
6. Blocks not accounted for anywhere.
7. Directory checks:
File pointing to unallocated inode.
Inode number out of range.
8. Super Block checks:
More blocks for inodes than there are in the file system.
9. Bad free block list format.
10. Total free block and/or free inode count incorrect.
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 preexist in the root of the file system being checked and must have empty slots in which entries can be made. This is accomplished by making lost+found, copying a number of files to the directory, and then removing them (before fsck is executed).
After fsck has checked and fixed the file system, it will store the correct fs_clean flag in the super block if it is not already there. For a non-root file system, FS_CLEAN will be stored there. For the root file system, which is mounted at the time of the fsck, no changes are required to the super block if there were no problems found and if FS_OK was already set.
Checking the raw device is almost always faster.
WARNINGS
Fsck should not be run on mounted file systems or on the raw root device.
DEPENDENCIES
Series 300
There is only one section per volume.
AUTHOR
Fsck was developed by HP, AT&T, and the University of California, Berkeley.
FILES
/etc/checklist contains default list of file systems to check.
SEE ALSO
fsclean(1M), mkfs(1M), newfs(1M), checklist(4), fs(4).
Hewlett-Packard Company — May 11, 2021