Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fsck(8) — SunOS 4.0.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fstab(5)

fs(5)

newfs(8)

mkfs(8)

crash(8S)

reboot(8)

FSCK(8)  —  MAINTENANCE COMMANDS

NAME

fsck − file system consistency check and interactive repair

SYNOPSIS

/usr/etc/fsck −p [ filesystem ... ]

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

DESCRIPTION

The first form of fsck preens a standard set of file systems or the specified file systems.  It is normally used in the /etc/rc script during automatic reboot.  In this case, fsck reads the table /etc/fstab to determine the file systems to check.  It inspects disks in parallel, taking maximum advantage of I/O overlap to check the file systems as quickly as possible. 

Normally, the root file system is checked in pass 1; other root-partition file systems are checked in pass 2.  Small file systems on separate partitions are checked in pass 3, while larger ones are checked in passes 4 and 5. 

Only partitions marked in /etc/fstab with a file system type of “4.2” and a non-zero pass number are checked. 

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 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 exits with an abnormal return status (and the reboot fails). 

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 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.  In this case, it 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 will default 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 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.  Incorrect directory sizes. 

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

Checking the raw device is almost always faster. 

OPTIONS

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

−w Check writable file systems only. 

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

−n Assume a no response to all questions asked by fsck; do not open the file system for writing.

FILES

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

DIAGNOSTICS

The diagnostics produced by fsck are fully enumerated and explained in System and Network Administration. 

EXIT STATUS

0 Either no errors detected or all errors were corrected. 

4 Root file system errors were corrected.  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 A signal was caught during processing. 

SEE ALSO

fstab(5), fs(5), newfs(8), mkfs(8), crash(8S), reboot(8)

System and Network Administration

BUGS

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

Sun Release 4.0  —  Last change: 24 September 1987

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