Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fstab(4)

fs(4)

newfs(1M)

mkfs(1M)

fsck(1M)

NAME

fsck − file system consistency check and interactive repair

SYNOPSIS

/etc/fsck −p [ filesystem ...  ]
/etc/fsck [ −b block# ] [ −y ] [ −n ] [ filesystem ] ... 

DESCRIPTION

The first form of fsck preens a standard set of filesystems or the specified file systems.  It is normally used in the script /etc/rc during automatic reboot.  In this case fsck reads the table /etc/fstab to determine which file systems to check.  It uses the information there to inspect groups of disks in parallel taking maximum advantage of i/o overlap to check the file systems as quickly as possible.  Normally, the root file system will be checked on pass 1 and the other file systems on pass 2.  Only partitions in fstab with a file system type of “4.2”, mounted “rw”, and that have a non-zero pass number are checked. 

fsck will only correct the following inconsistencies with the -p option:

Unreferenced inodes

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

These are the only inconsistencies which fsck with the −p option will correct; if it encounters other inconsistencies, it exits with an abnormal return status and an automatic reboot will then fail.  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.  After successfully correcting a file system, fsck will print the number of files on that file system, the number of used and free blocks, and the percentage of fragmentation. 

If sent a QUIT signal, fsck will finish the file system checks, then exit with an abnormal return status that causes the automatic reboot to fail.  This is useful when you wish to finish the file system check bu do not want the machine to come up multiuser. 

Without the −p option, fsck audits and interactively repairs inconsistent conditions for file systems.  If the file system is inconsistent the operator is prompted for concurrence before each correction is attempted.  Note that a number of the corrective actions which are not correctable under the −p option will result in some 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 on the file system fsck will default to a −n action. 

fsck has more consistency checks than its predecessors check, dcheck, fcheck, and icheck combined. 

The following flags are interpreted by fsck. 

−b Use the block specified immediately after the flag as the super block for the file system.  Block 16 is always an alternate super block. 

−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. 

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

Inconsistencies checked 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.  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 sepcified 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 later is given, fsck finds the name of the device on which the file system resides by looking at /etc/fstab. 

Checking the raw device is almost always faster. 

FILES

/etc/fstab contains default list of file systems to check. 

DIAGNOSTICS

The diagnostics produced by fsck are fully enumerated and explained in the chapter titled Managing Disk Drives, in the CX/UX System Administration Manual.

Exit Status

0 Either no errors detected or all errors were corrected. 

2 A Quit signal was caught during processing. 

4 Root file system errors were detected. The system must be rebooted. 

8 Some uncorrected errors exist on one or more of the file systems checked, there was a syntax error, or some other operational error occurred. 

12 An Intr signal was caught during processing. 

SEE ALSO

fstab(4), fs(4), newfs(1M), mkfs(1M)

BUGS

There should be some way to start a fsck −p at pass n. 

CX/UX Administrator’s Reference

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026