fsck Command – Check & Repair Linux & Unix File Systems

Phase 4: check reference counts

This phase checks the link count information obtained in Phases 2 and 3. It
reports error conditions resulting from:

  1. unreferenced files
  2. missing or full lost+found directory
  3. incorrect link counts for files, directories, symbolic links, or special
    files
  4. unreferenced files, symbolic links, and directories
  5. bad or duplicate blocks in files, symbolic links, and directories

fsck error messages, warning messages and responses for Phase 4 – check reference counts.

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

the inode number 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 the inode number are printed. When preening 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 the inode number to the file system in the directory for lost files (usually the lost+found directory). This may generate the lost+found error message in Phase 4 if there are problems connecting the inode number to the lost+found directory.

NO Ignore this error condition. This always invokes the CLEAR error condition in Phase 4.

4.2) (CLEAR)

The inode mentioned in the error message immediately preceding cannot be reconnected. This message cannot appear if the
file system is being repaired, because lack of space to reconnect files is a fatal error.

Possible responses to the CLEAR prompt are:
YES Deallocate the inode by zeroing out its contents.

NO Ignore this error condition.

4.3) NO lost+found DIRECTORY (CREATE)

There is no lost+found directory in the root directory of the filesystem; when preening, fsck 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 filesystem. This might generate the message:
NO SPACE LEFT IN / (EXPAND)

Possible responses. Inability to create a lost+found directory generates the message:
SORRY. CANNOT CREATE lost+found DIRECTORY
and aborts the attempt to link up the lost inode. This in turn generates the UNREF error message in Phase 4.

NO Abort the attempt to link up the lost inode. This generates the UNREF error message in Phase 4.

4.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 the lost+found directory to reference it. The previous inode reference by the lost+found directory is not cleared. Thus it is either reclaimed as an UNREFed inode or has its link count ADJUSTed later in this phase.
Inability to create a lost+found directory aborts the attempt to link up the lost inode and generates this message:
SORRY. CANNOT CREATE lost+found DIRECTORY
This generates the UNREF error message in Phase 4.

NO Abort the attempt to link up the lost inode. This generates the UNREF error message in Phase 4.

4.5) 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 filesystem. When preening, the lost+found directory is expanded.

Possible responses to the EXPAND prompt are:

YES Expand the lost+found directory to make room for the new entry. If the attempted expansion fails fsck aborts the attempt to link up the lost inode and prints this message:
SORRY. NO SPACE IN lost+found DIRECTORY
This generates the UNREF error message in Phase 4. Clear out
unnecessary entries in the lost+found directory. This error is fatal if the file system is being fixed.

NO Abort the attempt to link up the lost inode. This generates the UNREF error message in Phase 4.

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

The link count for the inode number is X but should be Y. The owner O, mode M, size S, and modify time T are printed. When preening, 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 during preening, fsck exits with the message:
LINK COUNT INCREASING

Possible responses to the ADJUST prompt are:

YES Replace the link count of file the inode number by Y.

NO Ignore this error condition.

4.7) UNREF TYPE I=OWNER=O MODE=M SIZE=S MTIME=T (CLEAR)

the inode number 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 the inode number are printed. Because this is a file that was not connected because its size or link count was zero, it is cleared during preening.

Possible responses to the CLEAR prompt are

YES Deallocate the inode number by zeroing out its contents.

NO Ignore this error condition.

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

Phase 1 or Phase 1B has found duplicate blocks or bad blocks associated with the inode number . The owner O, mode M, size S, and modify time T of the inode number are printed. This message cannot appear when the
file system is being repaired, because it would have caused a fatal error earlier.

Possible responses to the CLEAR prompt are:

YES De-allocate the inode number by zeroing out its contents.

NO Ignore this error condition.

Initialization Phase
** phase 1 – Check Blocks and Sizes
** phase 2 – Check Pathnames

** phase 3 – Check Connectivity

** phase 4 – Check Reference Counts
NEXT>>** phase 5 – Check Cylinder Groups
cleanup phase

2 thoughts on “fsck Command – Check & Repair Linux & Unix File Systems

Comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.