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).

Get Linux Pocket Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.