xref: /freebsd/share/doc/smm/03.fsck/4.t (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
Copyright (c) 1982, 1993
The Regents of the University of California. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

Appendix A - Fsck_ffs Error Conditions Conventions

Fsck_ffs is a multi-pass file system check program. Each file system pass invokes a different Phase of the fsck_ffs program. After the initial setup, fsck_ffs performs successive Phases over each file system, checking blocks and sizes, path-names, connectivity, reference counts, and the map of free blocks, (possibly rebuilding it), and performs some cleanup.

Normally fsck_ffs is run non-interactively to preen the file systems after an unclean halt. While preen'ing a file system, it will only fix corruptions that are expected to occur from an unclean halt. These actions are a proper subset of the actions that fsck_ffs will take when it is running interactively. Throughout this appendix many errors have several options that the operator can take. When an inconsistency is detected, fsck_ffs reports the error condition to the operator. If a response is required, fsck_ffs prints a prompt message and waits for a response. When preen'ing most errors are fatal. For those that are expected, the response taken is noted. This appendix explains the meaning of each error condition, the possible responses, and the related error conditions.

The error conditions are organized by the Phase of the fsck_ffs program in which they can occur. The error conditions that may occur in more than one Phase will be discussed in initialization. Initialization

Before a file system check can be performed, certain tables have to be set up and certain files opened. This section concerns itself with the opening of files and the initialization of tables. This section lists error conditions resulting from command line options, memory requests, opening of files, status of files, file system size checks, and creation of the scratch file. All the initialization errors are fatal when the file system is being preen'ed.

"C option?"

C is not a legal option to fsck_ffs ; legal options are -b, -c, -y, -n, and -p. Fsck_ffs terminates on this error condition. See the fsck_ffs (8) manual entry for further detail.

"cannot alloc NNN bytes for blockmap"

"cannot alloc NNN bytes for freemap"

"cannot alloc NNN bytes for statemap"

"cannot alloc NNN bytes for lncntp"

Fsck_ffs 's request for memory for its virtual memory tables failed. This should never happen. Fsck_ffs terminates on this error condition. See a guru.

"Can't open checklist file: F"

The file system checklist file F (usually /etc/fstab ) can not be opened for reading. Fsck_ffs terminates on this error condition. Check access modes of F.

"Can't stat root"

Fsck_ffs 's request for statistics about the root directory ``/'' failed. This should never happen. Fsck_ffs terminates on this error condition. See a guru.

"Can't stat F"

"Can't make sense out of name F"

Fsck_ffs 's request for statistics about the file system F failed. When running manually, it ignores this file system and continues checking the next file system given. Check access modes of F.

"Can't open F"

Fsck_ffs 's request attempt to open the file system F failed. When running manually, it ignores this file system and continues checking the next file system given. Check access modes of F.

"F: (NO WRITE)"

Either the -n flag was specified or fsck_ffs 's attempt to open the file system F for writing failed. When running manually, all the diagnostics are printed out, but no modifications are attempted to fix them.

"file is not a block or character device; OK"

You have given fsck_ffs a regular file name by mistake. Check the type of the file specified.

Possible responses to the OK prompt are:

YES
ignore this error condition.
NO
ignore this file system and continues checking the next file system given.

"UNDEFINED OPTIMIZATION IN SUPERBLOCK (SET TO DEFAULT)"

The superblock optimization parameter is neither OPT_TIME nor OPT_SPACE.

Possible responses to the SET TO DEFAULT prompt are:

YES
The superblock is set to request optimization to minimize running time of the system. (If optimization to minimize disk space utilization is desired, it can be set using tunefs(8).)
NO
ignore this error condition.

"IMPOSSIBLE MINFREE=D IN SUPERBLOCK (SET TO DEFAULT)"

The superblock minimum space percentage is greater than 99% or less then 0%.

Possible responses to the SET TO DEFAULT prompt are:

YES
The minfree parameter is set to 10%. (If some other percentage is desired, it can be set using tunefs(8).)
NO
ignore this error condition.

"IMPOSSIBLE INTERLEAVE=D IN SUPERBLOCK (SET TO DEFAULT)"

The file system interleave is less than or equal to zero.

Possible responses to the SET TO DEFAULT prompt are:

YES
The interleave parameter is set to 1.
NO
ignore this error condition.

"IMPOSSIBLE NPSECT=D IN SUPERBLOCK (SET TO DEFAULT)"

The number of physical sectors per track is less than the number of usable sectors per track.

Possible responses to the SET TO DEFAULT prompt are:

YES
The npsect parameter is set to the number of usable sectors per track.
NO
ignore this error condition.

One of the following messages will appear:

"MAGIC NUMBER WRONG"

"NCG OUT OF RANGE"

"CPG OUT OF RANGE"

"NCYL DOES NOT JIVE WITH NCG*CPG"

"SIZE PREPOSTEROUSLY LARGE"

"TRASHED VALUES IN SUPER BLOCK"

and will be followed by the message:

"F: BAD SUPER BLOCK: B"

"USE -b OPTION TO FSCK_FFS TO SPECIFY LOCATION OF AN ALTERNATE"

"SUPER-BLOCK TO SUPPLY NEEDED INFORMATION; SEE fsck_ffs(8)."

The super block has been corrupted. An alternative super block must be selected from among those listed by newfs (8) when the file system was created. For file systems with a blocksize less than 32K, specifying -b 32 is a good first choice.

"INTERNAL INCONSISTENCY: M"

Fsck_ffs 's has had an internal panic, whose message is specified as M. This should never happen. See a guru.

"CAN NOT SEEK: BLK B (CONTINUE)"

Fsck_ffs 's request for moving to a specified block number B in the file system failed. This should never happen. See a guru.

Possible responses to the CONTINUE prompt are:

YES
attempt to continue to run the file system check. Often, however the problem will persist. This error condition will not allow a complete check of the file system. A second run of fsck_ffs should be made to re-check this file system. If the block was part of the virtual memory buffer cache, fsck_ffs will terminate with the message ``Fatal I/O error''.
NO
terminate the program.

"CAN NOT READ: BLK B (CONTINUE)"

Fsck_ffs 's request for reading a specified block number B in the file system failed. This should never happen. See a guru.

Possible responses to the CONTINUE prompt are:

YES
attempt to continue to run the file system check. It will retry the read and print out the message:

"THE FOLLOWING SECTORS COULD NOT BE READ: N"

where N indicates the sectors that could not be read. If fsck_ffs ever tries to write back one of the blocks on which the read failed it will print the message:

"WRITING ZERO'ED BLOCK N TO DISK"

where N indicates the sector that was written with zero's. If the disk is experiencing hardware problems, the problem will persist. This error condition will not allow a complete check of the file system. A second run of fsck_ffs should be made to re-check this file system. If the block was part of the virtual memory buffer cache, fsck_ffs will terminate with the message ``Fatal I/O error''.

NO
terminate the program.

"CAN NOT WRITE: BLK B (CONTINUE)"

Fsck_ffs 's request for writing a specified block number B in the file system failed. The disk is write-protected; check the write protect lock on the drive. If that is not the problem, see a guru.

Possible responses to the CONTINUE prompt are:

YES
attempt to continue to run the file system check. The write operation will be retried with the failed blocks indicated by the message:

"THE FOLLOWING SECTORS COULD NOT BE WRITTEN: N"

where N indicates the sectors that could not be written. If the disk is experiencing hardware problems, the problem will persist. This error condition will not allow a complete check of the file system. A second run of fsck_ffs should be made to re-check this file system. If the block was part of the virtual memory buffer cache, fsck_ffs will terminate with the message ``Fatal I/O error''.

NO
terminate the program.

"bad inode number DDD to ginode"

An internal error has attempted to read non-existent inode DDD. This error causes fsck_ffs to exit. See a guru. Phase 1 - Check Blocks and Sizes

This phase concerns itself with the inode list. This section lists error conditions resulting from checking inode types, setting up the zero-link-count table, examining inode block numbers for bad or duplicate blocks, checking inode size, and checking inode format. All errors in this phase except "INCORRECT BLOCK COUNT" and "PARTIALLY TRUNCATED INODE" are fatal if the file system is being preen'ed.

"UNKNOWN FILE TYPE I=I (CLEAR)"

The mode word of the inode I indicates that the inode is not a special block inode, special character inode, socket inode, regular inode, symbolic link, or directory inode.

Possible responses to the CLEAR prompt are:

YES
de-allocate inode I by zeroing its contents. This will always invoke the UNALLOCATED error condition in Phase 2 for each directory entry pointing to this inode.
NO
ignore this error condition.

"PARTIALLY TRUNCATED INODE I=I (SALVAGE)"

Fsck_ffs has found inode I whose size is shorter than the number of blocks allocated to it. This condition should only occur if the system crashes while in the midst of truncating a file. When preen'ing the file system, fsck_ffs completes the truncation to the specified size.

Possible responses to SALVAGE are:

YES
complete the truncation to the size specified in the inode.
NO
ignore this error condition.

"LINK COUNT TABLE OVERFLOW (CONTINUE)"

An internal table for fsck_ffs containing allocated inodes with a link count of zero cannot allocate more memory. Increase the virtual memory for fsck_ffs .

Possible responses to the CONTINUE prompt are:

YES
continue with the program. This error condition will not allow a complete check of the file system. A second run of fsck_ffs should be made to re-check this file system. If another allocated inode with a zero link count is found, this error condition is repeated.
NO
terminate the program.

"B BAD I=I"

Inode I contains block number B with a number lower than the number of the first data block in the file system or greater than the number of the last block in the file system. This error condition may invoke the "EXCESSIVE BAD BLKS" error condition in Phase 1 (see next paragraph) if inode I has too many block numbers outside the file system range. This error condition will always invoke the "BAD/DUP" error condition in Phase 2 and Phase 4.

"EXCESSIVE BAD BLKS I=I (CONTINUE)"

There is more than a tolerable number (usually 10) of blocks with a number lower than the number of the first data block in the file system or greater than the number of last block in the file system associated with inode I.

Possible responses to the CONTINUE prompt are:

YES
ignore the rest of the blocks in this inode and continue checking with the next inode in the file system. This error condition will not allow a complete check of the file system. A second run of fsck_ffs should be made to re-check this file system.
NO
terminate the program.

"BAD STATE DDD TO BLKERR"

An internal error has scrambled fsck_ffs 's state map to have the impossible value DDD. Fsck_ffs exits immediately. See a guru.

"B DUP I=I"

Inode I contains block number B that is already claimed by another inode. This error condition may invoke the "EXCESSIVE DUP BLKS" error condition in Phase 1 if inode I has too many block numbers claimed by other inodes. This error condition will always invoke Phase 1b and the "BAD/DUP" error condition in Phase 2 and Phase 4.

"EXCESSIVE DUP BLKS I=I (CONTINUE)"

There is more than a tolerable number (usually 10) of blocks claimed by other inodes.

Possible responses to the CONTINUE prompt are:

YES
ignore the rest of the blocks in this inode and continue checking with the next inode in the file system. This error condition will not allow a complete check of the file system. A second run of fsck_ffs should be made to re-check this file system.
NO
terminate the program.

"DUP TABLE OVERFLOW (CONTINUE)"

An internal table in fsck_ffs containing duplicate block numbers cannot allocate any more space. Increase the amount of virtual memory available to fsck_ffs .

Possible responses to the CONTINUE prompt are:

YES
continue with the program. This error condition will not allow a complete check of the file system. A second run of fsck_ffs should be made to re-check this file system. If another duplicate block is found, this error condition will repeat.
NO
terminate the program.

"PARTIALLY ALLOCATED INODE I=I (CLEAR)"

Inode I is neither allocated nor unallocated.

Possible responses to the CLEAR prompt are:

YES
de-allocate inode I by zeroing its contents.
NO
ignore this error condition.

"INCORRECT BLOCK COUNT I=I (X should be Y) (CORRECT)"

The block count for inode I is X blocks, but should be Y blocks. When preen'ing the count is corrected.

Possible responses to the CORRECT prompt are:

YES
replace the block count of inode I with Y.
NO
ignore this error condition. Phase 1B: Rescan for More Dups

When a duplicate block is found in the file system, the file system is rescanned to find the inode that previously claimed that block. This section lists the error condition when the duplicate block is found.

"B DUP I=I"

Inode I contains block number B that is already claimed by another inode. This error condition will always invoke the "BAD/DUP" error condition in Phase 2. You can determine which inodes have overlapping blocks by examining this error condition and the DUP error condition in Phase 1. Phase 2 - Check Pathnames

This phase concerns itself with removing directory entries pointing to error conditioned inodes from Phase 1 and Phase 1b. This section lists error conditions resulting from root inode mode and status, directory inode pointers in range, and directory entries pointing to bad inodes, and directory integrity checks. All errors in this phase are fatal if the file system is being preen'ed, except for directories not being a multiple of the blocks size and extraneous hard links.

"ROOT INODE UNALLOCATED (ALLOCATE)"

The root inode (usually inode number 2) has no allocate mode bits. This should never happen.

Possible responses to the ALLOCATE prompt are:

YES
allocate inode 2 as the root inode. The files and directories usually found in the root will be recovered in Phase 3 and put into lost+found . If the attempt to allocate the root fails, fsck_ffs will exit with the message:

"CANNOT ALLOCATE ROOT INODE" .

NO
fsck_ffs will exit.

"ROOT INODE NOT DIRECTORY (REALLOCATE)"

The root inode (usually inode number 2) is not directory inode type.

Possible responses to the REALLOCATE prompt are:

YES
clear the existing contents of the root inode and reallocate it. The files and directories usually found in the root will be recovered in Phase 3 and put into lost+found . If the attempt to allocate the root fails, fsck_ffs will exit with the message:

"CANNOT ALLOCATE ROOT INODE" .

NO
fsck_ffs will then prompt with "FIX"

Possible responses to the FIX prompt are:

YES
replace the root inode's type to be a directory. If the root inode's data blocks are not directory blocks, many error conditions will be produced.
NO
terminate the program.

"DUPS/BAD IN ROOT INODE (REALLOCATE)"

Phase 1 or Phase 1b have found duplicate blocks or bad blocks in the root inode (usually inode number 2) for the file system.

Possible responses to the REALLOCATE prompt are:

YES
clear the existing contents of the root inode and reallocate it. The files and directories usually found in the root will be recovered in Phase 3 and put into lost+found . If the attempt to allocate the root fails, fsck_ffs will exit with the message:

"CANNOT ALLOCATE ROOT INODE" .

NO
fsck_ffs will then prompt with "CONTINUE" .

Possible responses to the CONTINUE prompt are:

YES
ignore the "DUPS/BAD" error condition in the root inode and attempt to continue to run the file system check. If the root inode is not correct, then this may result in many other error conditions.
NO
terminate the program.

"NAME TOO LONG F"

An excessively long path name has been found. This usually indicates loops in the file system name space. This can occur if the super user has made circular links to directories. The offending links must be removed (by a guru).

"I OUT OF RANGE I=I NAME=F (REMOVE)"

A directory entry F has an inode number I that is greater than the end of the inode list.

Possible responses to the REMOVE prompt are:

YES
the directory entry F is removed.
NO
ignore this error condition.

"UNALLOCATED I=I OWNER=O MODE=M SIZE=S MTIME=T type=F (REMOVE)"

A directory or file entry F points to an unallocated inode I. The owner O, mode M, size S, modify time T, and name F are printed.

Possible responses to the REMOVE prompt are:

YES
the directory entry F is removed.
NO
ignore this error condition.

"DUP/BAD I=I OWNER=O MODE=M SIZE=S MTIME=T type=F (REMOVE)"

Phase 1 or Phase 1b have found duplicate blocks or bad blocks associated with directory or file entry F, inode I. The owner O, mode M, size S, modify time T, and directory name F are printed.

Possible responses to the REMOVE prompt are:

YES
the directory entry F is removed.
NO
ignore this error condition.

"ZERO LENGTH DIRECTORY I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F (REMOVE)"

A directory entry F has a size S that is zero. The owner O, mode M, size S, modify time T, and directory name F are printed.

Possible responses to the REMOVE prompt are:

YES
the directory entry F is removed; this will always invoke the BAD/DUP error condition in Phase 4.
NO
ignore this error condition.

"DIRECTORY TOO SHORT I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F (FIX)"

A directory F has been found whose size S is less than the minimum size directory. The owner O, mode M, size S, modify time T, and directory name F are printed.

Possible responses to the FIX prompt are:

YES
increase the size of the directory to the minimum directory size.
NO
ignore this directory.

"DIRECTORY F LENGTH S NOT MULTIPLE OF B (ADJUST)

A directory F has been found with size S that is not a multiple of the directory blocksize B.

Possible responses to the ADJUST prompt are:

YES
the length is rounded up to the appropriate block size. This error can occur on 4.2BSD file systems. Thus when preen'ing the file system only a warning is printed and the directory is adjusted.
NO
ignore the error condition.

"DIRECTORY CORRUPTED I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F (SALVAGE)"

A directory with an inconsistent internal state has been found.

Possible responses to the FIX prompt are:

YES
throw away all entries up to the next directory boundary (usually 512-byte) boundary. This drastic action can throw away up to 42 entries, and should be taken only after other recovery efforts have failed.
NO
skip up to the next directory boundary and resume reading, but do not modify the directory.

"BAD INODE NUMBER FOR `.' I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F (FIX)"

A directory I has been found whose inode number for `.' does does not equal I.

Possible responses to the FIX prompt are:

YES
change the inode number for `.' to be equal to I.
NO
leave the inode number for `.' unchanged.

"MISSING `.' I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F (FIX)"

A directory I has been found whose first entry is unallocated.

Possible responses to the FIX prompt are:

YES
build an entry for `.' with inode number equal to I.
NO
leave the directory unchanged.

"MISSING `.' I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F"

"CANNOT FIX, FIRST ENTRY IN DIRECTORY CONTAINS F"

A directory I has been found whose first entry is F. Fsck_ffs cannot resolve this problem. The file system should be mounted and the offending entry F moved elsewhere. The file system should then be unmounted and fsck_ffs should be run again.

"MISSING `.' I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F"

"CANNOT FIX, INSUFFICIENT SPACE TO ADD `.'"

A directory I has been found whose first entry is not `.'. Fsck_ffs cannot resolve this problem as it should never happen. See a guru.

"EXTRA `.' ENTRY I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F (FIX)"

A directory I has been found that has more than one entry for `.'.

Possible responses to the FIX prompt are:

YES
remove the extra entry for `.'.
NO
leave the directory unchanged.

"BAD INODE NUMBER FOR `..' I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F (FIX)"

A directory I has been found whose inode number for `..' does does not equal the parent of I.

Possible responses to the FIX prompt are:

YES
change the inode number for `..' to be equal to the parent of I (``..'' in the root inode points to itself).
NO
leave the inode number for `..' unchanged.

"MISSING `..' I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F (FIX)"

A directory I has been found whose second entry is unallocated.

Possible responses to the FIX prompt are:

YES
build an entry for `..' with inode number equal to the parent of I (``..'' in the root inode points to itself).
NO
leave the directory unchanged.

"MISSING `..' I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F"

"CANNOT FIX, SECOND ENTRY IN DIRECTORY CONTAINS F"

A directory I has been found whose second entry is F. Fsck_ffs cannot resolve this problem. The file system should be mounted and the offending entry F moved elsewhere. The file system should then be unmounted and fsck_ffs should be run again.

"MISSING `..' I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F"

"CANNOT FIX, INSUFFICIENT SPACE TO ADD `..'"

A directory I has been found whose second entry is not `..'. Fsck_ffs cannot resolve this problem. The file system should be mounted and the second entry in the directory moved elsewhere. The file system should then be unmounted and fsck_ffs should be run again.

"EXTRA `..' ENTRY I=I OWNER=O MODE=M SIZE=S MTIME=T DIR=F (FIX)"

A directory I has been found that has more than one entry for `..'.

Possible responses to the FIX prompt are:

YES
remove the extra entry for `..'.
NO
leave the directory unchanged.

"N IS AN EXTRANEOUS HARD LINK TO A DIRECTORY D (REMOVE)

Fsck_ffs has found a hard link, N, to a directory, D. When preen'ing the extraneous links are ignored.

Possible responses to the REMOVE prompt are:

YES
delete the extraneous entry, N.
NO
ignore the error condition.

"BAD INODE S TO DESCEND"

An internal error has caused an impossible state S to be passed to the routine that descends the file system directory structure. Fsck_ffs exits. See a guru.

"BAD RETURN STATE S FROM DESCEND"

An internal error has caused an impossible state S to be returned from the routine that descends the file system directory structure. Fsck_ffs exits. See a guru.

"BAD STATE S FOR ROOT INODE"

An internal error has caused an impossible state S to be assigned to the root inode. Fsck_ffs exits. See a guru. Phase 3 - Check Connectivity

This phase concerns itself with the directory connectivity seen in Phase 2. This section lists error conditions resulting from unreferenced directories, and missing or full lost+found directories.

"UNREF DIR I=I OWNER=O MODE=M SIZE=S MTIME=T (RECONNECT)"

The directory inode I was not connected to a directory entry when the file system was traversed. The owner O, mode M, size S, and modify time T of directory inode I are printed. When preen'ing, the directory is reconnected if its size is non-zero, otherwise it is cleared.

Possible responses to the RECONNECT prompt are:

YES
reconnect directory inode I to the file system in the directory for lost files (usually lost+found). This may invoke the lost+found error condition in Phase 3 if there are problems connecting directory inode I to lost+found. This may also invoke the CONNECTED error condition in Phase 3 if the link was successful.
NO
ignore this error condition. This will always invoke the UNREF error condition in Phase 4.

"NO lost+found DIRECTORY (CREATE)"

There is no lost+found directory in the root directory of the file system; When preen'ing fsck_ffs tries to create a lost+found directory.

Possible responses to the CREATE prompt are:

YES
create a lost+found directory in the root of the file system. This may raise the message:

"NO SPACE LEFT IN / (EXPAND)"

See below for the possible responses. Inability to create a lost+found directory generates the message:

"SORRY. CANNOT CREATE lost+found DIRECTORY"

and aborts the attempt to linkup the lost inode. This will always invoke the UNREF error condition in Phase 4.

NO
abort the attempt to linkup the lost inode. This will always invoke the UNREF error condition in Phase 4.

"lost+found IS NOT A DIRECTORY (REALLOCATE)"

The entry for lost+found is not a directory.

Possible responses to the REALLOCATE prompt are:

YES
allocate a directory inode, and change lost+found to reference it. The previous inode reference by the lost+found name is not cleared. Thus it will either be reclaimed as an UNREF'ed inode or have its link count ADJUST'ed later in this Phase. Inability to create a lost+found directory generates the message:

"SORRY. CANNOT CREATE lost+found DIRECTORY"

and aborts the attempt to linkup the lost inode. This will always invoke the UNREF error condition in Phase 4.

NO
abort the attempt to linkup the lost inode. This will always invoke the UNREF error condition in Phase 4.

"NO SPACE LEFT IN /lost+found (EXPAND)"

There is no space to add another entry to the lost+found directory in the root directory of the file system. When preen'ing the lost+found directory is expanded.

Possible responses to the EXPAND prompt are:

YES
the lost+found directory is expanded to make room for the new entry. If the attempted expansion fails fsck_ffs prints the message:

"SORRY. NO SPACE IN lost+found DIRECTORY"

and aborts the attempt to linkup the lost inode. This will always invoke the UNREF error condition in Phase 4. Clean out unnecessary entries in lost+found . This error is fatal if the file system is being preen'ed.

NO
abort the attempt to linkup the lost inode. This will always invoke the UNREF error condition in Phase 4.

"DIR I=I1 CONNECTED. PARENT WAS I=I2"

This is an advisory message indicating a directory inode I1 was successfully connected to the lost+found directory. The parent inode I2 of the directory inode I1 is replaced by the inode number of the lost+found directory.

"DIRECTORY F LENGTH S NOT MULTIPLE OF B (ADJUST)

A directory F has been found with size S that is not a multiple of the directory blocksize B (this can reoccur in Phase 3 if it is not adjusted in Phase 2).

Possible responses to the ADJUST prompt are:

YES
the length is rounded up to the appropriate block size. This error can occur on 4.2BSD file systems. Thus when preen'ing the file system only a warning is printed and the directory is adjusted.
NO
ignore the error condition.

"BAD INODE S TO DESCEND"

An internal error has caused an impossible state S to be passed to the routine that descends the file system directory structure. Fsck_ffs exits. See a guru. Phase 4 - Check Reference Counts

This phase concerns itself with the link count information seen in Phase 2 and Phase 3. This section lists error conditions resulting from unreferenced files, missing or full lost+found directory, incorrect link counts for files, directories, symbolic links, or special files, unreferenced files, symbolic links, and directories, and bad or duplicate blocks in files, symbolic links, and directories. All errors in this phase are correctable if the file system is being preen'ed except running out of space in the lost+found directory.

"UNREF FILE I=I OWNER=O MODE=M SIZE=S MTIME=T (RECONNECT)"

Inode I was not connected to a directory entry when the file system was traversed. The owner O, mode M, size S, and modify time T of inode I are printed. When preen'ing the file is cleared if either its size or its link count is zero, otherwise it is reconnected.

Possible responses to the RECONNECT prompt are:

YES
reconnect inode I to the file system in the directory for lost files (usually lost+found). This may invoke the lost+found error condition in Phase 4 if there are problems connecting inode I to lost+found .
NO
ignore this error condition. This will always invoke the CLEAR error condition in Phase 4.

"(CLEAR)"

The inode mentioned in the immediately previous error condition can not be reconnected. This cannot occur if the file system is being preen'ed, since lack of space to reconnect files is a fatal error.

Possible responses to the CLEAR prompt are:

YES
de-allocate the inode mentioned in the immediately previous error condition by zeroing its contents.
NO
ignore this error condition.

"NO lost+found DIRECTORY (CREATE)"

There is no lost+found directory in the root directory of the file system; When preen'ing fsck_ffs tries to create a lost+found directory.

Possible responses to the CREATE prompt are:

YES
create a lost+found directory in the root of the file system. This may raise the message:

"NO SPACE LEFT IN / (EXPAND)"

See below for the possible responses. Inability to create a lost+found directory generates the message:

"SORRY. CANNOT CREATE lost+found DIRECTORY"

and aborts the attempt to linkup the lost inode. This will always invoke the UNREF error condition in Phase 4.

NO
abort the attempt to linkup the lost inode. This will always invoke the UNREF error condition in Phase 4.

"lost+found IS NOT A DIRECTORY (REALLOCATE)"

The entry for lost+found is not a directory.

Possible responses to the REALLOCATE prompt are:

YES
allocate a directory inode, and change lost+found to reference it. The previous inode reference by the lost+found name is not cleared. Thus it will either be reclaimed as an UNREF'ed inode or have its link count ADJUST'ed later in this Phase. Inability to create a lost+found directory generates the message:

"SORRY. CANNOT CREATE lost+found DIRECTORY"

and aborts the attempt to linkup the lost inode. This will always invoke the UNREF error condition in Phase 4.

NO
abort the attempt to linkup the lost inode. This will always invoke the UNREF error condition in Phase 4.

"NO SPACE LEFT IN /lost+found (EXPAND)"

There is no space to add another entry to the lost+found directory in the root directory of the file system. When preen'ing the lost+found directory is expanded.

Possible responses to the EXPAND prompt are:

YES
the lost+found directory is expanded to make room for the new entry. If the attempted expansion fails fsck_ffs prints the message:

"SORRY. NO SPACE IN lost+found DIRECTORY"

and aborts the attempt to linkup the lost inode. This will always invoke the UNREF error condition in Phase 4. Clean out unnecessary entries in lost+found . This error is fatal if the file system is being preen'ed.

NO
abort the attempt to linkup the lost inode. This will always invoke the UNREF error condition in Phase 4.

"LINK COUNT type I=I OWNER=O MODE=M SIZE=S MTIME=T COUNT=X SHOULD BE Y (ADJUST)"

The link count for inode I, is X but should be Y. The owner O, mode M, size S, and modify time T are printed. When preen'ing the link count is adjusted unless the number of references is increasing, a condition that should never occur unless precipitated by a hardware failure. When the number of references is increasing under preen mode, fsck_ffs exits with the message:

"LINK COUNT INCREASING"

Possible responses to the ADJUST prompt are:

YES
replace the link count of file inode I with Y.
NO
ignore this error condition.

"UNREF type I=I OWNER=O MODE=M SIZE=S MTIME=T (CLEAR)"

Inode I, was not connected to a directory entry when the file system was traversed. The owner O, mode M, size S, and modify time T of inode I are printed. When preen'ing, this is a file that was not connected because its size or link count was zero, hence it is cleared.

Possible responses to the CLEAR prompt are:

YES
de-allocate inode I by zeroing its contents.
NO
ignore this error condition.

"BAD/DUP type I=I OWNER=O MODE=M SIZE=S MTIME=T (CLEAR)"

Phase 1 or Phase 1b have found duplicate blocks or bad blocks associated with inode I. The owner O, mode M, size S, and modify time T of inode I are printed. This error cannot arise when the file system is being preen'ed, as it would have caused a fatal error earlier.

Possible responses to the CLEAR prompt are:

YES
de-allocate inode I by zeroing its contents.
NO
ignore this error condition. Phase 5 - Check Cyl groups

This phase concerns itself with the free-block and used-inode maps. This section lists error conditions resulting from allocated blocks in the free-block maps, free blocks missing from free-block maps, and the total free-block count incorrect. It also lists error conditions resulting from free inodes in the used-inode maps, allocated inodes missing from used-inode maps, and the total used-inode count incorrect.

"CG C: BAD MAGIC NUMBER"

The magic number of cylinder group C is wrong. This usually indicates that the cylinder group maps have been destroyed. When running manually the cylinder group is marked as needing to be reconstructed. This error is fatal if the file system is being preen'ed.

"BLK(S) MISSING IN BIT MAPS (SALVAGE)"

A cylinder group block map is missing some free blocks. During preen'ing the maps are reconstructed.

Possible responses to the SALVAGE prompt are:

YES
reconstruct the free block map.
NO
ignore this error condition.

"SUMMARY INFORMATION BAD (SALVAGE)"

The summary information was found to be incorrect. When preen'ing, the summary information is recomputed.

Possible responses to the SALVAGE prompt are:

YES
reconstruct the summary information.
NO
ignore this error condition.

"FREE BLK COUNT(S) WRONG IN SUPERBLOCK (SALVAGE)"

The superblock free block information was found to be incorrect. When preen'ing, the superblock free block information is recomputed.

Possible responses to the SALVAGE prompt are:

YES
reconstruct the superblock free block information.
NO
ignore this error condition. Cleanup

Once a file system has been checked, a few cleanup functions are performed. This section lists advisory messages about the file system and modify status of the file system.

"V files, W used, X free (Y frags, Z blocks)"

This is an advisory message indicating that the file system checked contained V files using W fragment sized blocks leaving X fragment sized blocks free in the file system. The numbers in parenthesis breaks the free count down into Y free fragments and Z free full sized blocks.

"***** REBOOT UNIX *****"

This is an advisory message indicating that the root file system has been modified by fsck_ffs. If UNIX is not rebooted immediately, the work done by fsck_ffs may be undone by the in-core copies of tables UNIX keeps. When preen'ing, fsck_ffs will exit with a code of 4. The standard auto-reboot script distributed with 4.3BSD interprets an exit code of 4 by issuing a reboot system call.

"***** FILE SYSTEM WAS MODIFIED *****"

This is an advisory message indicating that the current file system was modified by fsck_ffs. If this file system is mounted or is the current root file system, fsck_ffs should be halted and UNIX rebooted. If UNIX is not rebooted immediately, the work done by fsck_ffs may be undone by the in-core copies of tables UNIX keeps.