Appendix A. EFS Filesystems
Prev |  | Next

## Appendix A. EFS Filesystems

| Note: Support for EFS filesystems will be discontinued in a future IRIX release. For information on converting EFS filesystems to XFS filesystems, see Chapter 6, “Creating and Growing Filesystems”.

The EFS filesystem is the original IRIX filesystem. This appendix describes the EFS filesystem and provides information on how to perform various administration tasks on EFS filesystems.

The major sections in this appendix are:

- “EFS Filesystem Overview”

- “EFS Filesystem Creation”

- “EFS Filesystem Creation Procedure”

- “Growing an EFS Filesystem Onto Another Disk”

- “EFS Filesystem Checking”

- “EFS Filesystem Reorganization”

- “Repairing EFS Filesystem Problems”

## EFS Filesystem Overview

The EFS filesystem is the original IRIX filesystem. It contains an enhancement to the standard UNIX filesystem called extents (defined below), and thus is called the Extent File System (EFS). The maximum size of an EFS filesystem is about 8 GB. It uses a filesystem block size of 512 bytes and allows a maximum file size of 2 GB minus 1 byte.

Advanced features of EFS are that it keeps multiple inode tables in close proximity to data blocks rather than a single inode table, and it uses a bitmap to keep track of free blocks instead of a list of free blocks.

Inodes are created when an EFS filesystem is created, not when files are created. When a file is created, an inode is allocated to that file. Thus, the maximum number of files in a filesystem is limited by the number of inodes in that filesystem. By default, the number of inodes created is a function of the size of the partition or logical volume. Typically one inode is created for every 4 KB in the partition or logical volume. You can specify the number of inodes with the `-n` option to the filesystem creation command, `mkfs`. Inodes use disk space, so there is a tradeoff between the number of inodes and the amount of disk space available for files.

The first block of an EFS filesystem is not used. Information about the filesystem is stored in the second block of the filesystem (block 1), called the superblock. This information includes:

- The size of the filesystem, in both physical and logical blocks

- The read-only flag; if set, the filesystem is read only

- The superblock-modified flag; if set, the superblock has been modified

- The date and time of the last update

- The total number of index nodes (inodes) allocated

- The total number of inodes free

- The total number of free blocks

- The starting block number of the free block bitmap

The superblock bitmap is followed by the inodes and data blocks. Each contiguous group of data blocks that make up a file is called an extent. There are 12 extent addresses in an inode. Extents are of variable length, anywhere from 1 to 148 contiguous blocks.

An inode contains addresses for 12 extents, which can hold a combined 1536 blocks, or 786,432 bytes. If a file is large enough that it cannot fit in the 12 extents, each extent is then loaded with the address of up to 148 indirect extents. The indirect extents then contain the actual data that makes up the file. Because EFS uses indirect extents, you can create files up to 2 GB, assuming you have that much disk space available in your filesystem.

The last block of the filesystem is a duplicate of the filesystem superblock. This is a safety precaution that provides a backup of the critical information stored in the superblock.

## EFS Filesystem Creation

To turn a disk partition or logical volume into an EFS filesystem, the `mkfs` command must be used. It takes a disk partition or logical volume and divides it up into areas for data blocks, inodes, and free lists, and writes out the appropriate inode tables, superblocks, and block maps. It creates the filesystem's root directory and a `lost+found` directory.

An example `mkfs` command for making an EFS filesystem is:

    # mkfs -t efs /dev/rdsk/dks0d2s7

After using `mkfs` to create an EFS filesystem, run the `fsck` command to verify that the disk is consistent. For information on the `fsck` command, see“Repairing EFS Filesystem Problems”.

For more instructions on making EFS filesystems see “EFS Filesystem Creation Procedure”, and the `mkfs`(1M) and `mkfs_efs`(1M) reference pages.

## EFS Filesystem Creation Procedure

The procedure in this section explains how to make an EFS filesystem on a disk partition or on a logical volume and mount it. (See Chapter 4, “Creating and Administering XLV Logical Volumes”, for information on creating logical volumes.) This procedure assumes that the disk or logical volume is empty. If it contains valuable data, the data must be backed up because it is destroyed during this procedure.

| Tip: You can make an EFS filesystem on a disk partition using the Disk Manager in the System Toolchest. For information on the Disk Manager, see the “Disk Manager ” section in Chapter 3 of the Personal System Administration Guide.

| Caution: When you create a filesystem, all files already on the disk partition or logical volume are destroyed.

1. Identify the device name of the partition or logical volume where you plan to create the filesystem. This is the value of partition in the examples below. For example, if you plan to use partition 7 (the entire disk) of a SCSI option disk on controller 0 and drive address 2, partition is `/dev/dsk/dks0d2s7`. For more information on determining partition, see “Introduction to XLV Logical Volumes” in Chapter 3, and the `dks`(7M) reference page.

2. If the disk partition is already mounted, unmount it:

       # umount partition

   Any data that is on the disk partition is destroyed. To convert the data rather than destroy it, use the procedure in “Converting a Filesystem on an Option Disk From EFS to XFS” in Chapter 6 instead.

3. Create a new filesystem with the `mkfs` command, for example,

       # mkfs -t efs /dev/rdsk/dks0d2s7

   The argument to `mkfs` is the block or character device for the disk partition or logical volume. You can use either the block device or the character device.

   In the above example, `mkfs` uses default values for the filesystem parameters. If you want to use parameters other than the default, you can specify these on the mkfs command line. See the `mkfs_efs`(1M) reference page for information about using command line parameters and proto files.

4. To use the filesystem, you must mount it. For example,

       # mkdir /rsrch
       # mount /dev/dsk/dks0d2s7 /rsrch

   For more information about mounting filesystems, see “Manually Mounting Filesystems” in Chapter 7.

5. To configure the system so that this filesystem is automatically mounted when the system is booted up, add an entry in the file `/etc/fstab` for the new filesystem. For example,

       /dev/dsk/dks0d2s7 /rsrch efs rw,raw=/dev/rdsk/dks0d2s7 0 0

   For more information about automatically mounting filesystems, see “Mounting Filesystems Automatically With the /etc/fstab File” in Chapter 7.

## Growing an EFS Filesystem Onto Another Disk

The procedure in this section explains how to grow an EFS filesystem onto another disk.

The following steps show how to grow a filesystem mounted at `/disk2` onto an XLV logical volume created out of the `/disk2` disk partition and a new disk. The procedure assumes that the new disk is installed on the system and partitioned.

| Caution: All files on the additional disk are destroyed by this procedure.

1. Make a backup of the filesystem you are going to extend.

2. Unmount the `/disk2` filesystem:

       # umount /disk2

3. Use `xlv_make` to create an XLV logical volume out of the `/disk2` partition and the new disk. The `/disk2` partition must be the first volume element in the data subvolume. For example:

       # xlv_make
       xlv_make> vol xlv0
       xlv0
       xlv_make> data
       xlv0.data
       xlv_make> plex
       xlv0.data.0
       xlv_make> ve dks0d2s7
       xlv0.data.0.0
       xlv_make> ve dks0d3s7
       xlv0.data.0.1
       xlv_make> end
       Object specification completed
       xlv_make> exit
       Newly created objects will be written to disk.
       Is this what you want?(yes) yes
       Invoking xlv_assemble

4. Grow the EFS filesystem into the logical volume with the `growfs` command:

       # growfs /dev/xlv/xlv0

5. Run `fsck` on the expanded filesystem:

       # fsck /dev/xlv/xlv0

6. Mount the logical volume:

       # mount /dev/xlv/xlv0 /disk2

7. Change the entry for `/disk2` in the file `/etc/fstab` to mount the logical volume rather than the disk partition:

       /dev/xlv/xlv0 /disk2 efs rw,raw=/dev/rxlv/xlv0 0 0

## EFS Filesystem Checking

The `fsck` command checks EFS filesystem consistency and data integrity. Filesystems are usually checked automatically when the system is booted. Except for the root filesystem, filesystems must be unmounted while being checked. You might want to invoke `fsck` manually at these times:

- Before making a backup

- After doing a restore

- After doing disk maintenance

- Before installing software

- Before manually mounting a dirty filesystem

- When `fsck` runs automatically and has many errors

For a detailed explanation of the checks performed by `fsck` and the options it presents when it finds problems, see “Repairing EFS Filesystem Problems”.

Before checking an EFS filesystem other than the root filesystem for consistency, the filesystem should be unmounted. (The root filesystem can be checked while mounted.) Unmounting can be achieved by explicitly unmounting the filesystem, or by shutting the system down and bringing it up in single-user mode. (See“Unmounting Filesystems” in Chapter 7 for information on unmounting filesystems and the `single`(1M) reference page for information on shutting the system down and bringing it up in single-user mode.) Checking unmounted filesystems is described in “Checking Unmounted Filesystems”.

If you cannot shut down the system and cannot unmount the filesystem, but you need to perform the check immediately, you can run `fsck` in “no-write” mode. The `fsck` command checks the filesystem, but makes no changes and does not repair inconsistencies. The procedure is explained in “Checking Mounted Filesystems”.

You may find it convenient to check multiple filesystems at once. This is also known as parallel checking. The `fsck -m` flag is used for parallel checking. For more information about this and other `fsck` options, see the `fsck`(1M) reference page.

### Checking Unmounted Filesystems

To check a single, unmounted filesystem, enter this command as root:

    # fsck filesystem

filesystem is the device file name of the filesystem's disk partition or logical volume, for example `/dev/usr`, `/dev/dsk/dks0d2s7`, or `/dev/dsk/lv2`; see “Introduction to XLV Logical Volumes” in Chapter 3 and “Filesystem Names” in Chapter 5 for more information.

As `fsck` runs, it proceeds through a series of steps, or phases. You may see an error-free check:

    fsck: Checking /dev/usr
    ** Phase 1 - Check Blocks and Sizes
    ** Phase 2 - Check Pathnames
    ** Phase 3 - Check Connectivity
    ** Phase 4 - Check Reference Counts
    ** Phase 5 - Check Free List
    7280 files 491832 blocks 38930 free

If there are no errors, you are finished checking the filesystem.

If errors are detected in the filesystem, `fsck` displays an error message. “Repairing EFS Filesystem Problems” explains how to proceed.

### Checking Mounted Filesystems

If you cannot shut down the system and cannot unmount the filesystem, but you need to perform the check immediately, you can run `fsck` in “no-write” mode. The `fsck` command checks the filesystem, but makes no changes and does not repair inconsistencies.

For example, the following command invokes `fsck` in no-write mode:

    # fsck -n /dev/usr

If inconsistencies are found, they are not repaired. You must run `fsck` again without the `-n` flag to repair any problems. The benefit of this procedure is that you should be able to gauge the severity of the problems with your filesystem. The disadvantage of this procedure is that `fsck` may show inconsistencies that do not really exist (because the filesystem is active).

## EFS Filesystem Reorganization

EFS filesystems can become fragmented over time. When a filesystem is fragmented, blocks of free space are small and files have many extents. The `fsr` command, when run on an EFS filesystem, reorganizes filesystems so that the layout of the extents is improved and free disk space is coalesced. This improves overall performance.

By default, `fsr` is run automatically once a week from `crontab`. If the `fsr` command determines that a mounted filesystem is an EFS filesystem, the command calls the `fsr_efs` command. See the `fsr`(1M) reference page for information on the `fsr` command, and the `fsr_efs`(1M) man page for information on the `fsr_efs` options for the command.

## EFS Filesystem Disk Space Management

Consider the following characteristics of EFS filesystems when managing your disk space:

- If you find yourself short on disk space, consider that the `lost+found` directory at the root of EFS filesystems may be full. If you log in as root, you can check this directory and determine if the files there can be removed.

- On EFS filesystems, when a filesystem is more than about 90- to 95-percent full, system performance may degrade, depending on the size of the disk. (The number of free disk blocks on a 97-percent full large disk is larger than the number of free disk blocks on a 97-percent full small disk.) Monitor the amount of available space and take steps to keep an adequate amount available.

## Using Disk Quotas on EFS Filesystems

The use of disk quotas to limit users' use of disk space is discussed in the section “Disk Quotas” in Chapter 5. The following subsections explain how to impose and monitor disk quotas on EFS filesystems. For additional information, see the `quota`(1), `edquota`(1M), `quot`(1M), `quotacheck`(1M), `quotaon`(1M), `repquota`(1M), and `quotas`(4) reference pages.

### Imposing Disk Quotas on EFS Filesystems

To impose soft disk quotas on EFS filesystems, follow these steps:

1. To enable the quotas subsystem, enter these commands:

       # chkconfig quotas on
       # chkconfig quotacheck on

2. Create a file named `quotas` in the root directory of each filesystem that is to have a disk quota. This file should be zero length and should be writable only by root. To create the `quotas` file, give this command as root in the root directory of each of these filesystems:

       # touch quotas

3. Establish the quota amounts for individual users. The `edquota` command can be used to set the limits for each user. For example, to set soft limits of 100 MB and 100 inodes on the user ID `sedgwick`, give the following command:

       # /usr/etc/edquota sedgwick

   The screen clears, and you are placed in the editor specified by the `EDITOR` environment variable (`vi` if `$EDITOR` is not set) to edit the user's disk quota. You see:

       fs /  kbytes(soft=0, hard=0)  inodes(soft=0, hard=0)

   The filesystem appears first, in this case the root filesystem (`/`). The numeric values for disk space are in kilobytes, not megabytes, so to specify 100 megabytes, you must multiply the number by 1024. The number of inodes should be entered directly.

4. Edit the line to appear as follows:

       fs / kbytes(soft=102400, hard=0)  inodes(soft=100, hard=0)

5. Save the file and quit the editor after you enter the correct values. If you leave the value at 0, no limit is imposed. Because you are setting only soft limits in this example, the hard values have not been set.

6. Use the `-p` option of `edquota` to assign the same quota to multiple users. Unless explicitly given a quota, users have no limits set on the amount of disk they can use or the number of files they can create.

7. Issue the `quotaon` command to put the quotas into effect. For quotas to be accurate, this command should be issued on a local filesystem immediately after the filesystem has been mounted. The `quotaon` command enables quotas for a particular filesystem, or with the -a option, enables quotas for all filesystems indicated in `/etc/fstab` as using quotas. See the `fstab(4)` reference page for complete details on the `/etc/fstab` file.

Quotas will be automatically enabled at boot time in the future. The script`/etc/init.d/quotas` handles enabling of quotas and uses the `chkconfig` command to check the `quotas` configuration flag to decide whether or not to enable quotas. If you need to turn quotas off, use the `quotaoff` command.

### Monitoring Disk Quotas on EFS Filesystems

Periodically, check the records retained in the quota file for consistency with the actual number of blocks and files allocated to the user using the `quotacheck` command. It is not necessary to unmount the filesystem or disable the quota system to run this command, though on active filesystems, slightly inaccurate results may be seen.

`quotacheck` is run automatically at boot time by the `/etc/init.d/quotas` script if the `quotacheck` flag has been turned on with `chkconfig`. `quotacheck` can take a considerable amount of time to execute, so it is convenient to have it done at boot time.

## Repairing EFS Filesystem Problems

The `fsck` command checks EFS filesystem consistency and sometimes repairs problems that are found. This section describes the messages that are produced by each phase of `fsck`, what they mean, and what you should do about each one.

### General Errors

The following abbreviations are used in `fsck` error messages:

BLK |  | Block number
DUP |  | Duplicate block number
DIR |  | Directory name
MTIME |  | Time file was last modified
UNREF |  | Unreferenced

The following sections use these single-letter abbreviations:

B |  | Block number
F |  | File (or directory) name
I |  | Inode number
M |  | File mode
O |  | User ID of a file's owner
S |  | File size
T |  | Time file was last modified
X |  | Link count, or number of BAD, DUP, or MISSING blocks, or number of files (depending on context)
Y |  | Corrected link count number, or number of blocks in filesystem (depending on context)
Z |  | Number of free blocks

In actual `fsck` output, these abbreviations are replaced by the appropriate numbers.

Two error messages may appear in any phase. Although `fsck` prompts for you to continue checking the filesystem, it is generally best to regard these errors as fatal. Stop the command and investigate what may have caused the problem.

`CAN NOT READ: BLK` B`(CONTINUE?)` |  | The request to read a specified block number B in the filesystem failed. This error indicates a serious problem, probably a hardware failure or an error that causes `fsck` to try to read a block that is not in the filesystem. Press `n` to stop `fsck`. Shut down the system to the System Maintenance Menu and run hardware diagnostics on the disk drive and controller.
`CAN NOT WRITE: BLK` B`(CONTINUE?)` |  | The request for writing a specified block number B in the filesystem failed. The disk may be write-protected or there may be a hardware problem. Press `n` to stop `fsck`. Check to make sure the disk is not set to “read only.” (Some, though not all, disks have this feature.) If the disk is not write-protected, shut down the system to the System Maintenance Menu and run hardware diagnostics on the disk drive and controller.

### Initialization Phase

The command line syntax is checked. Before the filesystem check can be performed, `fsck` sets up some tables and opens some files. The `fsck` command terminates if there are initialization errors.

### Phase 1 Check Blocks and Sizes

This phase checks the inode list. It reports 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

- Checking inode format

#### Phase 1 Error Messages

Phase 1 has three types of error messages: information messages, messages with a `CONTINUE?` prompt, and messages with a `CLEAR?` prompt. The responses that you give to Phase 1 prompts affect `fsck` functions. The possible responses are discussed in “Phase 1 Responses”. Typically, the right answer is Yes, except as noted.

`UNKNOWN FILE TYPE I=`I`(CLEAR?`) |  | The mode word of the inode I suggests that the inode is not a pipe, special character inode, regular inode, directory inode, symbolic link, or socket.
`LINK COUNT TABLE OVERFLOW (CONTINUE?)` |  | There is no more room in an internal table for `fsck` containing allocated inodes with a link count of zero.
B `BAD I=`I |  | Inode I contains block number B with a number lower than the number of the first data block in the filesystem or greater than the number of the last block in the filesystem. This error condition may invoke the `EXCESSIVE BAD BLKS` error condition in Phase 1 if inode I has too many block numbers outside the filesystem range. This error condition invokes the `BAD/DUP` error condition in Phase 2 and Phase 4.
`EXCESSIVE BAD BLOCKS I=`I`(CONTINUE?)` |  | There is more than a tolerable number (usually 50) of blocks with a number lower than the number of the first data block in the filesystem or greater than the number of the last block in the filesystem associated with inode I.
B `DUP I=`I |  | Inode I contains block number B, which 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 invokes Phase 1B and the `BAD/DUP` error condition in Phase 2 and Phase 4. Typically, you should answer No the first time this error appears and Yes the second time if you know the files claimed by the other inode.
`EXCESSIVE DUP BLKS I=`I`(CONTINUE?)` |  | There is more than a tolerable number (usually 50) of blocks claimed by other inodes.
`DUP TABLE OVERFLOW (CONTINUE?)` |  | There is no more room in an internal table in fsck containing duplicate block numbers.
`PARTIALLY ALLOCATED INODE I=`I`(CLEAR?)` |  | Inode I is neither allocated nor unallocated.
`RIDICULOUS NUMBER OF EXTENTS (`n`) (max allowed` n) |  | The number of extents is larger than the maximum the system can set and is therefore ridiculous.
`ILLEGAL NUMBER OF INDIRECT EXTENTS (`n`)` |  | The number of extents or pointers to extents (indirect extents) exceeds the number of slots in the inode for describing extents.
`BAD MAGIC IN EXTENT` |  | The pointer to an extent contains a “magic number.” If this number is invalid, the pointer to the extent is probably corrupt.
`EXTENT OUT OF ORDER` |  | An extent's idea of where it is in the file is inconsistent with the extent pointer in relation to other extent pointers.
`ZERO LENGTH EXTENT` |  | An extent is zero length.
`ZERO SIZE DIRECTORY` |  | It is erroneous for a directory inode to claim a size of zero. The corresponding inode is cleared.
`DIRECTORY SIZE ERROR` |  | A directory's size must be an integer number of blocks. The size is recomputed based on its extents.
`DIRECTORY EXTENTS CORRUPTED` |  | If the computation of size (above) fails, `fsck` prints this message and asks to clear the inode.
`NUMBER OF EXTENTS TOO LARGE` |  | The number of extents or pointers to extents (indirect extents) exceeds the number of slots in the inode for describing extents.
`POSSIBLE DIRECTORY SIZE ERROR` |  | The number of blocks in the directory computed from extent pointer lengths is inconsistent with the number computed from the inode size field.
`POSSIBLE FILE SIZE ERROR` |  | The number of blocks in the file computed from extent pointer lengths is inconsistent with the number computed from the inode size field. `fsck` gives the option of clearing the inode in this case.

#### Phase 1 Responses

Table A-1 explains the significance of responses to Phase 1 prompts:

Table A-1. Meaning of fsck Phase 1 Responses

Prompt | Response | Meaning
--- | --- | ---
`CONTINUE?` | `n` | Terminate the command.
`CONTINUE?` | `y` | Continue with the command. This error condition means that a complete check of the filesystem is not possible. A second run of `fsck` should be made to recheck this filesystem.
`CLEAR?` | `n` | Ignore the error condition. A No response is appropriate only if the user intends to take other measures to fix the problem.
`CLEAR?` | `y` | Deallocate inode I by zeroing its contents. This may invoke the `UNALLOCATED` error condition in Phase 2 for each directory entry pointing to this inode.

#### Phase 1B Rescan for More Bad Dups

When a duplicate block is found in the filesystem, the filesystem is rescanned to find the inode that previously claimed that block. When the duplicate block is found, the following information message is printed:

B `DUP I=`I |  | Inode I contains block number B, which is already claimed by another inode. This error condition invokes the `BAD/DUP` error condition in Phase 2. Inodes with overlapping blocks can be determined by examining this error condition and the `DUP` error condition in Phase 1.

### Phase 2 Check Pathnames

This phase traverses the pathname tree, starting at the root directory. `fsck` examines each inode that is being used by a file in a directory of the filesystem being checked.

Referenced files are marked in order to detect unreferenced files later on. The command also accumulates a count of all links, which it checks against the link counts found in Phase 4.

Phase 2 reports error conditions resulting from the following:

- Root inode mode and status incorrect

- Directory inode pointers out of range

- Directory entries pointing to bad inodes

`fsck` examines the root directory inode first, because this directory is where the search for all pathnames must start.

If the root directory inode is corrupted, or if its type is not`directory`, `fsck` prints error messages. Generally, if a severe problem exists with the root directory it is impossible to salvage the filesystem. `fsck` allows attempts to continue under some circumstances.

#### Phase 2 Error Messages

The following error messages result from problems with the root directory inode. The possible responses are discussed in “Phase 2 Responses”.

`ROOT INODE UNALLOCATED. TERMINATING` |  | The root inode points to incorrect information. There is no way to fix this problem, so the command stops. If this problem occurs on the root filesystem, you must reinstall IRIX. If it occurs on another filesystem, you must recreate the filesystem using `mkfs` and recover files and data from backups.
`ROOT INODE NOT A DIRECTORY. FIX?` |  | The root directory inode does not seem to describe a directory. This error is usually fatal. The typical answer is Yes.
`DUPS/BAD IN ROOT INODE. CONTINUE?` |  | Something is wrong with the block addressing information of the root directory. The typical answer is Yes.

Other Phase 2 messages have a `REMOVE?` prompt. These messages are:

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. The typical answer is Yes.
`UNALLOCATED I=`I `OWNER=`O `MODE=`M `SIZE=`S `MTIME=`T `NAME=`F`(REMOVE?)` |  | A directory entry F has an inode I that is not marked as allocated. The owner O, mode M, size S, modify time T, and filename F are printed. If the filesystem is not mounted and the `-n` option is not specified, and if the inode that the entry points to is size 0, the entry is removed automatically.
`DUP/BAD I=`I `OWNER=`O `MODE=`M `SIZE=`S `MTIME=`T `DIR=`F`(REMOVE?)` |  | Phase 1 or Phase 1B found duplicate blocks or bad blocks associated with directory entry F, directory inode I. The owner O, mode M, size S, modify time T, and directory name F are printed. Typically, you should answer No the first time this error appears and Yes the second time if you know the files claimed by the other inode.
`DUP/BAD I=`I `OWNER=`O `MODE=`M `SIZE=`S `MTIME=`T `FILE=`F`(REMOVE?)` |  | Phase 1 or Phase 1B found duplicate blocks or bad blocks associated with file entry F, inode I. The owner O, mode M, size S, modify time T, and filename F are printed. Typically, you should answer No the first time this error appears and Yes the second time if you know the files claimed by the other inode.

#### Phase 2 Responses

Table A-2 describes the significance of responses to Phase 2 prompts:

Table A-2. Meaning of Phase 2 fsck Responses

Prompt | Response | Meaning
--- | --- | ---
`FIX?` | `n` | `fsck` terminates.
`FIX?` | `y` | `fsck` treats the contents of the inode as a directory, even though the inode mode indicates otherwise. If the directory is actually intact, and only the inode mode is incorrectly set, this may recover the directory.
`CONTINUE?` | `n` | `fsck` terminates.
`CONTINUE?` | `y` | `fsck` attempts to continue with the check. If some of the root directory is still readable, pieces of the files system may be salvaged.
`REMOVE?` | `n` | Ignore the error condition. A No response is appropriate only if the user intends to take other action to fix the problem.
`REMOVE?` | `y` | Remove a bad directory entry.

### Phase 3 Check Connectivity

Phase 3 of `fsck` locates any unreferenced directories detected in Phase 2 and attempts to reconnect them. It reports error conditions resulting from:

- Unreferenced directories

- Missing or full `lost+found` directories

#### Phase 3 Error Messages

Phase 3 has two types of error messages: information messages and messages with a `RECONNECT?` prompt. The possible responses are discussed in “Phase 3 Responses”.

`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 filesystem was traversed. The owner O, mode M, size S, and modify time T of directory inode I are printed. The `fsck` command forces the reconnection of a nonempty directory. The typical answer is yes.
`SORRY. NO lost+found DIRECTORY` |  | No `lost+found` directory is in the root directory of the filesystem; `fsck` ignores the request to link a directory in `lost+found`. The unreferenced file is removed. Use `fsck -l` to recover and remake the `lost+found` directory as soon as possible.
`SORRY. NO SPACE IN lost+found DIRECTORY` |  | There is no space to add another entry to the `lost+found` directory in the root directory of the filesystem; `fsck` ignores the request to link a directory in `lost+found`. The unreferenced file is removed. Use `fsck -l` to recover and clean out the `lost+found` directory as soon as possible.
`DIR I=`I1 `CONNECTED. PARENT WAS I=`I2 |  | This is an advisory message indicating that 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.

#### Phase 3 Responses

Table A-3 explains the significance of responses to Phase 3 prompts:

Table A-3. Meaning of fsck Phase 3 Responses

Prompt | Response | Meaning
--- | --- | ---
`RECONNECT?` | `n` | Ignore the error condition. This invokes the `UNREF` error condition in Phase 4. A No response is appropriate only if the user intends to take other action to fix the problem.
`RECONNECT?` | `y` | Reconnect directory inode I to the filesystem in the directory for lost files (`lost+found`). This may invoke a lost+found error condition if there are problems connecting directory inode I to `lost+found`. If the link was successful, this invokes a `CONNECTED` information message.

### Phase 4 Check Reference Counts

This phase checks the link count information seen in Phases 2 and 3 and locates any unreferenced regular files. It reports error conditions resulting from:

- Unreferenced files

- A missing or full `lost+found` directory

- Incorrect link counts for files, directories, or special files

- Unreferenced files and directories

- Bad and duplicate blocks in files and directories

- Incorrect counts of total free inodes

#### Phase 4 Error Messages

Phase 4 has five types of error messages:

- Information messages

- Messages with a `RECONNECT?` prompt

- Messages with a `CLEAR?` prompt

- Messages with an `ADJUST?` prompt

- Messages with a `FIX?` prompt

The possible responses are discussed in “Phase 4 Responses”.The typical answer is `Yes`, except as noted.

`UNREF FILE I=`I `OWNER=`O `MODE=`M `SIZE=`S `MTIME=`T`(RECONNECT?)` |  | Inode I was not connected to a directory entry when the filesystem was traversed. The owner O, mode M, size S, and modify time T of inode I are printed. If the `-n` option is omitted and the filesystem is not mounted, empty files are cleared automatically. Nonempty files are not cleared.
`SORRY. NO lost+found DIRECTORY` |  | There is no `lost+found` directory in the root directory of the filesystem; `fsck` ignores the request to link a file in `lost+found`. Use `fsck -l` to recover and create the `lost+found` directory as soon as possible.
`SORRY. NO SPACE IN lost+found DIRECTORY` |  | There is no space to add another entry to the `lost+found` directory in the root directory of the filesystem; `fsck` ignores the request to link a file in `lost+found`. Use `fsck -l` to recover and clean out the `lost+found` directory as soon as possible.
`(CLEAR)` |  | ``The inode mentioned in the immediately previous `UNREF` error condition cannot be reconnected, so it is cleared.
`LINK COUNT FILE I=`I `OWNER=`O `MODE=`M `SIZE=`S `MTIME=`T `COUNT=`X `SHOULD BE` Y`(ADJUST?)` |  | The link count for inode I, which is a file, is X but should be Y. The owner O, mode M, size S, and modify time T are printed.
`LINK COUNT DIR I=`I `OWNER=`O `MODE=`M `SIZE=`S `MTIME=`T `COUNT=`X `SHOULD BE` Y`(ADJUST?)` |  | The link count for inode I, which is a directory, is X but should be Y. The owner O, mode M, size S, and modify time T of directory inode I are printed.
`LINK COUNT` F `I=`I `OWNER=`O `MODE=`M `SIZE=`S `MTIME=`T `COUNT=`X `SHOULD BE` Y`(ADJUST?)` |  | The link count for F inode I is X but should be Y. The filename F, owner O, mode M, size S, and modify time T are printed.
`UNREF FILE I=`I `OWNER=`O `MODE=`M `SIZE=`S `MTIME=`T`(CLEAR?)` |  | Inode I, which is a file, was not connected to a directory entry when the filesystem was traversed. The owner O, mode M, size S, and modify time T of inode I are printed. If the `-n` option is omitted and the filesystem is not mounted, empty files are cleared automatically. Nonempty directories are not cleared. Typically, you should answer no the first time this error appears and yes the second time if you know the files claimed by the other inode.
`UNREF DIR I=`I `OWNER=`O `MODE=`M `SIZE=`S `MTIME=`T`(CLEAR?)` |  | Inode I, which is a directory, was not connected to a directory entry when the filesystem was traversed. The owner O, mode M, size S, and modify time T of inode I are printed. If the `-n` option is omitted and the filesystem is not mounted, empty directories are cleared automatically. Nonempty directories are not cleared. Typically, you should answer no the first time this error appears and yes the second time if you know the files claimed by the other inode.
`BAD/DUP FILE I=`I `OWNER=`O `MODE=`M `SIZE=`S `MTIME=`T`(CLEAR?)` |  | Phase 1 or Phase 1B found duplicate blocks or bad blocks associated with file inode I. The owner O, mode M, size S, and modify time T of inode I are printed. Typically, you should answer no the first time this error appears and yes the second time if you know the files claimed by the other inode.
`BAD/DUP DIR I=`I `OWNER=`O `MODE=`M `SIZE=`S `MTIME=`T`(CLEAR?)` |  | Phase 1 or Phase 1B found duplicate blocks or bad blocks associated with directory inode I. The owner O, mode M, size S, and modify time T of inode I are printed. Typically, you should answer no the first time this error appears and yes the second time if you know the files claimed by the other inode.
`FREE INODE COUNT WRONG IN SUPERBLK (FIX?)` |  | The actual count of the free inodes does not match the count in the superblock of the filesystem.

#### Phase 4 Responses

Table A-4 describes the significance of responses to Phase 4 prompts:

Table A-4. Meaning of fsck Phase 4 Responses

Prompt | Response | Meaning
--- | --- | ---
`RECONNECT?` | `n` | Ignore this error condition. This invokes a CLEAR error condition later in Phase 4.
`RECONNECT?` | `y` | Reconnect inode I to filesystem in the directory for lost files (`lost+found`). This can cause a lost+found error condition in this phase if there are problems connecting inode I to `lost+found`.
`CLEAR?` | `n` | Ignore the error condition. A No response is appropriate only if the user intends to take other action to fix the problem.
`CLEAR?` | `y` | Deallocate the inode by zeroing its contents.
`ADJUST?` | `n` | Ignore the error condition. A No response is appropriate only if the user intends to take other action to fix the problem.
`ADJUST?` | `y` | Replace link count of file inode I with the link counted computed in Phase 2.
`FIX?` | `n` | Ignore the error condition. A No response is appropriate only if the user intends to take other action to fix the problem.
`FIX?` | `y` | Fix the problem.

### Phase 5 Check Free List

Phase 5 checks the free-block list. It reports error conditions resulting from:

- Bad blocks in the free-block list

- Bad free-block count

- Duplicate blocks in the free-block list

- Unused blocks from the filesystem not in the free-block list

- Total free-block count incorrect

#### Phase 5 Error Messages

Phase 5 has four types of error messages:

- Information messages

- Messages that have a `CONTINUE?` prompt

- Messages that have a `FIX?` prompt

- Messages that have a `SALVAGE?` prompt

The possible responses are discussed in “Phase 5 Responses”.The typical answer is `Yes`.

`FREE BLK COUNT WRONG IN SUPERBLOCK (FIX?`) |  | The actual count of free blocks does not match the count in the superblock of the filesystem.
`BAD FREE LIST (SALVAGE?)` |  | This message is always preceded by one or more of the Phase 5 information messages.

#### Phase 5 Responses

Table A-5 describes the significance of responses to Phase 5 prompts:

Table A-5. Meanings of Phase 5 fsck Responses

Prompt | Response | Meaning
--- | --- | ---
`CONTINUE?` | `n` | Terminate the command.
`CONTINUE?` | `y` | Ignore the rest of the free-block list and continue execution of fsck. This error condition always invokes a `BAD BLKS IN FREE LIST` error condition later in Phase 5.
`FIX?` | `n` | Ignore the error condition. A No response is appropriate only if the user intends to take other action to fix the problem.
`FIX?` | `y` | Replace count in superblock by actual count.
`SALVAGE?` | `n` | Ignore the error condition. A No response is appropriate only if the user intends to take other action to fix the problem.
`SALVAGE?` | `y` | Replace actual free-block bitmap with a new free-block bitmap.

### Phase 6 Salvage Free List

This phase reconstructs the free-block bitmap. There are no error messages that can be generated in this phase and no responses are required.

### Cleanup Phase

Once a filesystem has been checked, a few cleanup functions are performed. The cleanup phase displays advisory messages about the filesystem and status of the filesystem.

#### Cleanup Phase Messages

X `files` Y `blocks` Z `free` |  | This is an advisory message indicating that the filesystem checked contained X files using Y blocks leaving Z blocks free in the filesystem.
`SUPERBLOCK MARKED DIRTY` |  | A field in the superblock is queried by system commands to decide if `fsck` must be run before mounting a filesystem. If this field is not “clean,”`fsck` reports and asks if it should be cleaned.
`PRIMARY SUPERBLOCK WAS INVALID` |  | If the primary superblock is too corrupt to use, and `fsck` can locate a secondary superblock, it asks to replace the primary superblock with the backup.
`SECONDARY SUPERBLOCK MISSING` |  | If there is no secondary superblock, and `fsck` finds space for one, it asks to create a secondary superblock.
`CHECKSUM WRONG IN SUPERBLOCK` |  | An incorrect checksum makes a filesystem unmountable.
`***** FILE SYSTEM WAS MODIFIED *****` |  | This is an advisory message indicating that the current filesystem was modified by `fsck`.
`***** REMOUNTING ROOT... *****` |  | This is an advisory message indicating that `fsck` made changes to a mounted root filesystem. The automatic remount ensures that in-core data structures and the filesystem are consistent.

Prev | Table of Contents | Next
Chapter 8. System Administration for Guaranteed-Rate I/O |  | Index