dfsck Command

Purpose

Checks and repairs two file systems simultaneously on different drives.

Syntax

dfsckFlagList1 ] FileSystem1FlagList2 ] FileSystem2

Description

The dfsck command lets you simultaneously check two file systems on two different drives. Use the FlagList1 and FlagList2 parameters to pass flags and parameters for the two sets of file systems. For a list of valid flags for FlagList1 and FlagList2, see the flags section. Use a - (minus sign) to separate the file system groups if you specify flags as part of the arguments.

The dfsck command permits you to interact with two fsck commands at once. To aid in this, the dfsck command displays the file system name with each message. When responding to a question from the dfsck command, prefix your response with a 1 or a 2 to indicate whether the answer refers to the first or second file system group.

Attention: Do not use the dfsck command to check the root file system.

Flags

Item Description
-dBlockNumber Searches for references to a specified disk block. Whenever the fsck command encounters a file that contains a specified block, it displays the i-node number and all path names that refer to it.
-f Performs a fast check. Under normal circumstances, the only file systems likely to be affected by halting the system without shutting down properly are those that are mounted when the system stops. The -f flag prompts the fsck command not to check file systems that were unmounted successfully. The fsck command determines this by inspecting the s_fmod flag in the file system superblock. This flag is set whenever a file system is mounted and cleared when it is unmounted successfully. If a file system is unmounted successfully, it is unlikely to have any problems. Because most file systems are unmounted successfully, not checking those file systems can reduce the checking time.
-ii-NodeNumber Searches for references to a specified i-node. Whenever the fsck command encounters a directory reference to a specified i-node, it displays the full path name of the reference.
-n Assumes a no response to all questions asked by the fsck command; does not open the specified file system for writing.
-o Options Passes comma-separated options to the fsck command. These options are assumed to be file system implementation-specific, except that the following are currently supported for all file systems:
mountable
Causes the fsck command to exit with success, returning a value of 0, if the file system in question is mountable (clean). If the file system is not mountable, the fsck command exits returning with a value of 8.
mytype
Causes the fsck command to exit with success (0) if the file system in question is of the same type as either specified in the /etc/filesystems file or by the -V flag on the command line. Otherwise, 8 is returned. For example, fsck -o mytype -V jfs / exits with a value of 0 if / (the root file system) is a journaled file system.
-p Does not display messages about minor problems but fixes them automatically. This flag does not grant the wholesale license that the -y flag does and is useful for performing automatic checks when the system is started normally. You should use this flag as part of the system startup procedures, whenever the system is being run automatically. Also allows parallel checks by group.
-tFile Specifies a File parameter as a scratch file on a file system other than the one being checked, if the fsck command cannot obtain enough memory to keep its tables. If you do not specify the -t flag and the fsck command needs a scratch file, it prompts you for the name of the scratch file. However, if you have specified the -p flag, the fsck command is unsuccessful. If the scratch file is not a special file, it is removed when the fsck command ends.
-V VfsName Uses the description of the virtual file system specified by the VFSName variable for the file system instead of using the /etc/filesystems file to determine the description. If the -V VfsName flag is not specified on the command line, the /etc/filesystems file is checked and the vfs=Attribute of the matching stanza is assumed to be the correct file system type.
-y Assumes a yes response to all questions asked by the fsck command. This flag lets the fsck command take any action it considers necessary. Use this flag only on severely damaged file systems.

Security

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in AIX® Version 7.1 Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

Examples

  1. To simultaneously check two file systems on two different drives, enter:

    dfsck  -p /dev/hd1 -  -p /dev/hd7

    This command checks both file systems simultaneously, if the file systems on the /dev/hd1 and /dev/hd7 devices are located on two different drives. You can also specify the file system names found in the /etc/filesystems file.

Files

Item Description
/usr/sbin/dfsck Contains the dfsck command.
/etc/filesystems Lists the known file systems and defines their characteristics.
/etc/vfs Contains descriptions of virtual file system types.
/etc/rc Contains commands (including the fsck command) that are run when the system is started.