How to Use 'fsck' to Check and Repair File System Errors in Linux

Any Linux user must have experienced file corruptions and booting failures at least once in their life. Being an I.T professional for many years, I have encountered this problem many times. Linux comes with a handy command called 'fsck' to save you. Fsck stands for File System Consistency Checker.

When and Where to use fsck?

A common reason of file corruption is an unforeseen power off of the computer due to hardware failure. Improper shutdown, accidental system -file deletion, and viruses can cause file corruption and an unstable system. Some file corruptions are less harmful and users can continue working. However, it is important to run a “fsck” once in a while as a regular practice.

How to use fsck?

Interactive mode

Checks system files and asks for operator confirmation at each file error detected. It can continue with repair or proceed without any changes.

Non-interactive mode

It can continue the repair without any user interaction. In this mode, all the files detected with errors get repaired automatically. If a system file is detected, the system boots to single user mode and asks for user's confirmation to manually repair files.

While Running fsck, be smart!

You should always run fsck in the single user mode to prevent any further file corruptions. The simple reason is when running in multiuser mode, files change constantly thereby leading to further corruptions.
If you cannot boot into single mode, you should unmount each partition and run fsck. You cannot un mount root/usr file system . In case the root/usr file system is corrupt, you can boot from a Linux cd and run the fsck .

Running in single user mode

Unmount the file system:

$ init 1
$ umount /home
$ fsck /dev/sda1

$ fsck /home


$ fsck /dev/sda1


$ e2fsck -y /dev/sda1

Running in rescue mode using boot cd

Insert installation cd and reboot the pc:

$ shutdown -r now

After booting, use cd type following at the boot prompt

Boot: Linux rescue nomount

Since we passed nomount option, kernel will not initialize any filesystem or its related device file. So, we need to create it manually.

Now, create new node for disk and partition 1.

# mknod /dev/sda
# mknod /dev/sda1

# fsck /dev/sda1


# e2fsck -y /dev/sda1

Note: You need to reboot the system after running fsck.


Always unmount the device for the files system you want to run the fsck. Suppose, you want to check file consistency in hard disk 1 (/dev/sda1):

$umount /dev/sda1

This is what happens when you run the fsck without unmounting file system:

Fsck Mount Filesystem

As a regular practice, run a “fsck” occasionally in your Linux box. Remember that “prevention is better than the cure”.

Read Also:

Bobbin Zachariah 8:28 am

About Bobbin Zachariah

Founder of LinOxide, passionate lover of Linux and technology writer. Started his career in Linux / Opensource from 2000. Love traveling, blogging and listening music. Reach Bobbin Zachariah about me page and google plus page.

Author's All Posts
Like to become part of Linoxide Team and contribute tips? Contact us here.


Your email address will not be published. Required fields are marked *

All comments are subject to moderation.