fsck

Table of Contents

Overview

Check and repair a Linux filesystem.

How to Install

Install

This is builtin command.

Usage

Syntax

fsck [-lrsAVRTMNP] [-C [fd]] [-t fstype] [filesystem ... ] [--] [fs-specific-options]

Description

  • fsck is used to check and optionally repair one or more Linux filesystems.
  • filesys can be a device name (e.g. /dev/hdc1, /dev/sdb2), a mount point (e.g. /, /usr,

/home), or an ext2 label or UUID specifier (e.g. UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root).

  • Normally, the fsck program will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of them.
  • If no filesystems are specified on the command line, and the -A option is not specified, fsck will default to checking filesystems in /etc/fstab serially. This is

equivalent to the -As options.

  • The exit code returned by fsck is the sum of the following conditions:

    #  
    0 No errors
    1 Filesystem errors corrected
    2 System should be rebooted
    4 Filesystem errors left uncorrected
    8 Operational error
    16 Usage or syntax error
    32 Checking canceled by user request
    128 Shared-library error
  • The exit code returned when multiple filesystems are checked is the bit-wise OR of the exit codes for each filesystem that is checked.
  • In actuality, fsck is simply a front-end for the various filesystem checkers (fsck.fstype) available under Linux. The filesystem-specific checker is searched for in the PATH environment variable. If the PATH is undefined then fallback to "/sbin".

Please see the filesystem-specific checker manual pages for further details.

Configuration

/etc/fstab

  • FSCK_FORCE_ALL_PARALLEL
  • FSCK_MAX_INST
  • PATH
  • FSTAB_FILE
  • LIBBLKID_DEBUG=0xffff
  • LIBMOUNT_DEBUG=0xffff

Options

  • -l : Create an exclusive flock(2) lock file (/run/fsck/<diskname>.lock) for whole-disk device. This option can be used with one device only (this means that -A and -l are mutually exclusive). This option is recommended when more fsck(8) instances are executed in the same time. The option is ignored when used for multiple devices or for non-rotating disks. fsck does not lock underlying devices when executed to check stacked devices (e.g. MD or DM) – this feature is not implemented yet.
  • -r [fd] :
  • -s :
  • -t fslist :
  • -A :
  • -C [fd ] :
  • -M :
  • -N :
  • -P :
  • -R :
  • -T :
  • -V :

fs-specific-options

  • -a :
  • -n :
  • -r :
  • -y :

Date: 2018-02-20

Author: Dongsoo Lee

Created: 2018-12-10 Mon 03:07

Validate