18.7 Checking and Repairing a File System

The fsck utility checks and repairs file systems. For file systems other than / (root) and /boot, mount invokes file system checking if more than a certain number of mounts have occurred or more than 180 days have elapsed without checking having being performed. You might want to run fsck manually if a file system has not been checked for several months.


Running fsck on a mounted file system can corrupt the file system and cause data loss.

To check and repair a file system:

  1. Unmount the file system:

    # umount filesystem
  2. Use the fsck command to check the file system:

    # fsck [-y] filesystem

    filesystem be a device name, a mount point, or a label or UUID specifier, for example:

    # fsck UUID=ad8113d7-b279-4da8-b6e4-cfba045f66ff

    By default, fsck prompts you to choose whether it should apply a suggested repair to the file system. If you specify the -y option, fsck assumes a yes response to all such questions.

For the ext2, ext3, and ext4 file system types, other commands that are used to perform file system maintenance include dumpe2fs and debugfs. dumpe2fs prints super block and block group information for the file system on a specified device. debugfs is an interactive file system debugger that requires expert knowledge of the file system architecture. Similar commands exist for most file system types and also require expert knowledge.

For more information, see the fsck(8) manual page.