System Administration Guide, Volume 1

Generic fsck Command Syntax, Options, and Arguments

The fsck command has two components: a generic component and a component specific to each type of file system. The generic commands apply to most types of file systems, while the specific commands apply to only one type of file system. You should always use the generic command, which calls the file system-specific command, as needed.

Usually, you must be superuser to run fsck. You can run the fsck command without being superuser; but to make repairs, you should unmount the file system and you must have read permission for the raw device file for the slice (a potential security hole).

The generic fsck command goes through /etc/vfstab to see what file systems to check. It runs the appropriate file system-specific fsck command on each file system listed, except those excluded by an fsck pass number of - or 0 (UFS only).

The generic fsck command has the following syntax:

/usr/sbin/fsck [-F type] [-V] [-m] [special]
/usr/sbin/fsck [-F type] [-V] [-y|Y|n|N] [-o specific-options][special]

The table below describes the options and arguments to the generic fsck command.

Table 39-4 The fsck Command Options and Arguments

Option Type 





Specifies the file system type (type). If type is not specified on the command line, it is obtained from /etc/vfstab by matching an entry in that file with the special device name specified. If no entry is found, the default local file system type specified in /etc/default/fs is used.



Echoes the completed command line (verbose). The echoed line includes additional information derived from /etc/vfstab. This option can be used to verify and validate the command line. It does not execute the command.



Performs a preliminary check only. It returns a code indicating the state of the file system: 0 for "clean" and 32 for "dirty." This option is used by the startup script /sbin/rcS to determine whether a file system needs to be checked.


-y or -Y or -n or -N

Runs the command automatically answering yes or no to all prompts. 



Converts an old pre-SunOS 4.1 file system with statically allocated tables to new dynamically allocated tables. Static allocation imposes a hard maximum on table size, while dynamic allocation means space for tables can be added as needed after the initial allocation. If the file system is in the new format, convert it to the old format, unless the table allocation exceeds the fixed maximum allowed in the old format. fsck lists the direction of the conversion. In interactive mode, fsck prompts for confirmation before doing the conversion. When you use the -o p option, the conversion is attempted without asking for confirmation. This option is useful when you want to convert a number of file systems at once. You can determine whether a file system is in the old or new format by running the fstyp command, and looking at the first line displayed.



Checks only file systems that permit write access. 



Specifies the mount point or raw device name of one or more file systems. An entry for the mount point must exist in /etc/vfstab. If you omit the special argument, entries in /etc/vfstab with a specified fsck device and a fsck pass number greater than zero are checked. If preening (-o p) is in effect and more than one entry has an fsck pass number greater than 1, file systems on different disks are checked in parallel.



This is a comma-separated list of options that follow the -o option. Describes the options that are passed to the UFS-specific fsck command for interpretation.



Preens. Runs the command automatically in silent mode, correcting what it can, but exiting when it encounters a problem that requires intervention. This option also enables parallel checking of UFS file systems. 



Uses the alternative (redundant) superblock, located at the specified location. This option can be used to repair a bad superblock. You can display a list of alternative superblocks by using the newfs -N command.