O'Reilly logo

Linux Pocket Guide, 2nd Edition by Daniel J. Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

fsck — stdin  stdout  - file  -- opt  --help  --version

Synopsis

fsck [options] [devices]

The fsck (filesystem check) command validates a Linux disk partition and, if requested, repairs errors found on it. fsck is run automatically when your system boots; however, you can run it manually if you like. In general, unmount a device before checking it, so no other programs are operating on it at the same time:

# umount /dev/sda10
# fsck -f /dev/sda10
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/home: 172/1281696 files (11.6% non-contiguous), ...

fsck is a frontend for a set of filesystem-checking programs found in /sbin, with names beginning “fsck”. Only certain types of filesystems are supported; you can list them with the command:

$ ls /sbin/fsck.* | cut -d. -f2

Useful options

-A

Check all disks listed in /etc/fstab, in order.

-N

Print a description of the checking that would be done, but exit without performing any checking.

-r

Fix errors interactively, prompting before each fix.

-a

Fix errors automatically (use only if you really know what you’re doing; if not, you can seriously mess up a filesystem).

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required