1 FSCK(1M)                     Maintenance Commands                     FSCK(1M)
   2 
   3 
   4 
   5 NAME
   6        fsck - check and repair file systems
   7 
   8 SYNOPSIS
   9        fsck [-F FSType] [-m] [-V] [-v] [special]...
  10 
  11 
  12        fsck [-F FSType] [-n | N | y | Y] [-V] [-v]
  13             [-o FSType-specific-options] [special]...
  14 
  15 
  16 DESCRIPTION
  17        fsck audits and interactively repairs inconsistent file system
  18        conditions. If the file system is inconsistent the default action for
  19        each correction is to wait for the user to respond yes or no. If the
  20        user does not have write permission fsck defaults to a no action.  Some
  21        corrective actions will result in loss of data. The amount and severity
  22        of data loss can be determined from the diagnostic output.
  23 
  24 
  25        FSType-specific-options are options specified in a comma-separated (with
  26        no intervening spaces) list of options or keyword-attribute pairs for
  27        interpretation by the FSType-specific module of the command.
  28 
  29 
  30        special represents the character special device on which the file
  31        system resides, for example, /dev/rdsk/c1t0d0s7. Note: the character
  32        special device, not the block special device, should be used. fsck will
  33        not work if the block device is mounted.
  34 
  35 
  36        If no special device is specified fsck checks the file systems listed
  37        in /etc/vfstab. Those entries in /etc/vfstab which have a character
  38        special device entry in the fsckdev field and have a non-zero numeric
  39        entry in the fsckpass field will be checked. Specifying -F FSType limits
  40        the file systems to be checked to those of the type indicated.
  41 
  42 
  43        If special is specified, but -F is not, the file system type will be
  44        determined by looking for a matching entry in /etc/vfstab. If no entry
  45        is found, the default local file system type specified in
  46        /etc/default/fs will be used.
  47 
  48 
  49        If a file system type supports parallel checking, for example, ufs,
  50        some file systems eligible for checking may be checked in parallel.
  51        Consult the file system-specific man page (for example, fsck_ufs(1M))
  52        for more information.
  53 
  54 OPTIONS
  55        The following generic options are supported:
  56 
  57        -F FSType
  58            Specify the file system type on which to operate.
  59 
  60 
  61        -m
  62            Check but do not repair. This option checks that the file system is
  63            suitable for mounting, returning the appropriate exit status. If
  64            the file system is ready for mounting, fsck displays a message such
  65            as:
  66 
  67              ufs fsck: sanity check: /dev/rdsk/c0t3d0s1 okay
  68 
  69 
  70 
  71 
  72        -n | -N
  73            Assume a no response to all questions asked by fsck; do not open
  74            the file system for writing.
  75 
  76 
  77        -V
  78            Echo the expanded command line but do not execute the command. This
  79            option may be used to verify and to validate the command line.
  80 
  81 
  82        -v
  83            Enables verbose output. Might not be supported by all filesystem-
  84            specific fsck implementations.
  85 
  86 
  87        -y | Y
  88            Assume a yes response to all questions asked by fsck.
  89 
  90 
  91        -o specific-options
  92            These specific-options can be any combination of the following
  93            separated by commas (with no intervening spaces).
  94 
  95            b=n
  96                Use block n as the super block for the file system. Block 32 is
  97                always one of the alternate super blocks. Determine the
  98                location of other super blocks by running newfs(1M) with the -Nv
  99                options specified.
 100 
 101 
 102            c
 103                If the file system is in the old (static table) format, convert
 104                it to the new (dynamic table) format. If the file system is in
 105                the new format, convert it to the old format provided the old
 106                format can support the file system configuration. In
 107                interactive mode, fsck will list the direction the conversion
 108                is to be made and ask whether the conversion should be done. If
 109                a negative answer is given, no further operations are done on
 110                the file system. In preen mode, the direction of the conversion
 111                is listed and done if possible without user interaction.
 112                Conversion in preen mode is best used when all the file systems
 113                are being converted at once. The format of a file system can be
 114                determined from the first line of output from fstyp(1M). Note:
 115                the c option is seldom used and is included only for
 116                compatibility with pre-4.1 releases. There is no guarantee that
 117                this option will be included in future releases.
 118 
 119 
 120            f
 121                Force checking of file systems regardless of the state of their
 122                super block clean flag.
 123 
 124 
 125            p
 126                Check and fix the file system non-interactively ("preen"). Exit
 127                immediately if there is a problem requiring intervention. This
 128                option is required to enable parallel file system checking.
 129 
 130 
 131            w
 132                Check writable file systems only.
 133 
 134 
 135 
 136 EXIT STATUS
 137        0
 138            file system is unmounted and OK
 139 
 140 
 141        1
 142            erroneous parameters are specified
 143 
 144 
 145        32
 146            file system is unmounted and needs checking (fsck -m only)
 147 
 148 
 149        33
 150            file system is already mounted
 151 
 152 
 153        34
 154            cannot stat device
 155 
 156 
 157        35
 158            a filesystem that is mounted read/write was modified - reboot
 159 
 160 
 161        36
 162            uncorrectable errors detected - terminate normally
 163 
 164 
 165        37
 166            a signal was caught during processing
 167 
 168 
 169        39
 170            uncorrectable errors detected - terminate immediately
 171 
 172 
 173        40
 174            file system is mounted read-only and is OK
 175 
 176 
 177 USAGE
 178        The fsck command is large file aware for UFS file systems, per the
 179        largefile(5) man page.
 180 
 181 FILES
 182        /etc/default/fs
 183            default local file system type. Default values can be set for the
 184            following flags in /etc/default/fs. For example: LOCAL=ufs.
 185 
 186            LOCAL
 187                The default partition for a command if no FSType is specified.
 188 
 189 
 190 
 191        /etc/vfstab
 192            list of default parameters for each file system
 193 
 194 
 195 ATTRIBUTES
 196        See attributes(5) for descriptions of the following attributes:
 197 
 198 
 199 
 200 
 201        +--------------------+-----------------+
 202        |  ATTRIBUTE TYPE    | ATTRIBUTE VALUE |
 203        +--------------------+-----------------+
 204        |Interface Stability | Committed       |
 205        +--------------------+-----------------+
 206 
 207 SEE ALSO
 208        clri(1M), fsck_ufs(1M), fsdb_ufs(1M), fsirand(1M), fstyp(1M), mkfs(1M),
 209        mkfs_ufs(1M), mountall(1M), newfs(1M), reboot( 1M), vfstab(4),
 210        attributes(5), largefile(5), ufs(7FS)
 211 
 212 WARNINGS
 213        The operating system buffers file system data. Running fsck on a
 214        mounted file system can cause the operating system's buffers to become
 215        out of date with respect to the disk. For this reason, the file system
 216        should be unmounted when fsck is used. If this is not possible, care
 217        should be taken that the system is quiescent and that it is rebooted
 218        immediately after fsck is run. Quite often, however, this will not be
 219        sufficient. A panic will probably occur if running fsck on a file
 220        system modifies the file system.
 221 
 222 NOTES
 223        This command may not be supported for all FSTypes.
 224 
 225 
 226        Starting with Solaris 9, fsck manages extended attribute data on the
 227        disk. (See fsattr(5) for a description of extended file attributes.) A
 228        file system with extended attributes can be mounted on versions of
 229        Solaris that are not attribute-aware (versions prior to Solaris 9), but
 230        the attributes will not be accessible and fsck will strip them from the
 231        files and place them in lost+found. Once the attributes have been
 232        stripped, the file system is completely stable on versions of Solaris
 233        that are not attribute-aware, but would be considered corrupted on
 234        attribute-aware versions. In the latter circumstance, run the attribute-
 235        aware fsck to stabilize the file system before using it in an
 236        attribute-aware environment.
 237 
 238 
 239 
 240                                September 8, 2015                      FSCK(1M)