Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fsck(1M) — Interactive 3.2r4.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

crash(1M)

mkfs(1M)

ncheck(1M)

xfsck(1M)

uadmin(2)

checklist(4)

fs(4)

fsck(1M)  —  

NAME

fsck, dfsck − check and repair file systems

SYNOPSIS

/etc/fsck [−y] [−n] [−sX] [−SX] [−t file] [−q] [−D] [−Q] [−f] [−b] [−L] [−l] [file-systems]
/etc/dfsck [options1] fsys1 ... − [options2] fsys2 ...

DESCRIPTION

fsck

The fsck command audits and interactively repairs inconsistent conditions for file systems.  If the file system is found to be consistent, the number of files, blocks used, and blocks free are reported.  If the file system is inconsistent, the user is prompted for concurrence before each correction is attempted.  It should be noted that most corrective actions will result in some loss of data.  The amount and severity of data loss may be determined from the diagnostic output.  The default action for each correction is to wait for the user to respond yes or no.  If the user does not have write permission, fsck defaults to a −n action. 

The following options are accepted by fsck:

−y Assume a yes response to all questions asked by fsck.

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

−sX Ignore the actual free list and (unconditionally) reconstruct a new one by rewriting the super block of the file system.  The file system should be unmounted while this is done; if this is not possible, care should be taken that the system is quiescent and that it is rebooted immediately afterwards.  This precaution is necessary so that the old, bad, in-core copy of the super block will not continue to be used, or written on the file system. 

The −sX option allows for creating an optimal free-list organization. 

If X is not given, the values used when the file system was created are used.  The format of X is cylinder size:gap size. 

−SX Conditionally reconstruct the free list. This option is like −sX above except that the free list is rebuilt only if there were no discrepancies discovered in the file system. Using −S will force a no response to all questions asked by fsck. This option is useful for forcing free list reorganization on uncontaminated file systems.

−t If fsck cannot obtain enough memory to keep its tables, it uses a scratch file. If the −t option is specified, the file named in the next argument is used as the scratch file, if needed. Without the −t flag, fsck will prompt the user for the name of the scratch file. The file chosen should not be on the file system being checked, and if it is not a special file or did not already exist, it is removed when fsck completes. 

−q Quiet fsck. Do not print size-check messages.  Unreferenced fifos will silently be removed.  If fsck requires it, counts in the super block will be automatically fixed and the free list salvaged. 

−D Directories are checked for bad blocks.  Useful after system crashes. 

−Q Remove unreferenced pipes.  Useful after system crashes. 

−f Fast check.  Check block and sizes and check the free list.  The free list will be reconstructed, if necessary. 

−b Reboot.  If the file system being checked is the root file system and modifications have been made, then either remount the root file system or reboot the system.  A remount is done only if there was minor damage. 

−l Convert a S5L long-name file system to a standard S51K or S52K file system.  fsck will scan the file system for files with names longer than the 14-character limit of the S51K and S52K file systems, and will not allow the conversion to occur if any long names are present.  If no long names are found, this option simply updates portions of the super block of the file system, and does not change any actual data within the file system. 

−L Convert to a long-name (S5L) file system from a standard S51K or S52K file system.  This option simply updates portions of the super block of the file system, and does not change any actual data within the file system. 

If no file-systems are specified, fsck will read a list of default file systems from the file /etc/checklist. 

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:

Incorrect number of blocks. 
Directory size not 16-byte aligned.

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 than 65536 inodes. 
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 user’s concurrence, reconnected by placing them in the lost+found directory, if the files are nonempty.  The user will be notified if the file or directory is empty or not.  Empty files or directories are removed, as long as the −n option is not specified.  fsck will force the reconnection of nonempty directories.  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). 

Checking the raw device is almost always faster and should be used with everything but the root file system. 

dfsck

The dfsck command allows two file system checks on two different drives simultaneously.  options1 and options2 are used to pass options to fsck for the two sets of file systems.  A − is the separator between the file system groups. 

The dfsck command permits a user to interact with two fsck programs at once.  To aid in this, dfsck will print the file system name for each message to the user.  When answering a question from dfsck, the user must prefix the response with a 1 or a 2 (indicating that the answer refers to the first or second file system group). 

FILES

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

SEE ALSO

crash(1M), mkfs(1M), ncheck(1M), xfsck(1M), uadmin(2), checklist(4), fs(4). 

BUGS

Inode numbers for .  and .. in each directory are not checked for validity. 

ADDED VALUE

This entry, supplied by SunSoft, Inc., contains enhancements to UNIX ­System V. 

\*U  —  Version 1.0

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