What is e2fsck and When and How to run/execute e2fsck ?

What is e2fsck ?

e2fsck – check a Linux ext2/ext3 file system. e2fsck is a file system check utility that check the file systems for bad sectors , I/O errors related to HDD . e2fsck is used to check and optionally repair one or more Linux file systems.

When you need to run FSCK ?

You need to run e2fsck when one of your partition got mounted as read-only or you want to scan your HDD for bad sectors.


How to run e2fsck ?

First of all you need to unmount the partition on which you want to execute e2fsck , you can unmount a partition using the below commands :

root@server[#] umount partition name

for example :

root@server[#] umount /dev/sda2

If you encountered a error like :

umount device or resource busy

Then try the below command :

root@server[#] umount -l partition name

for example :

root@server[#] umount -l /dev/sda2

umount -l means : Lazy unmount. It Detach the filesystem from the filesystem hierarchy now, and then cleanup all references to the filesystem as soon as it is not busy anymore. To avoid any confusion ,this command doesn’t
force any thing at all.

Then, once you unmount the partition , run the below commands to execute e2fsck

root@server[#] e2fsck -y -v -f partition name

for example :

root@server[#] e2fsck -y -v -f /dev/sda2

or the safest way is :

root@server[#] shutdown -Fr now

This will Force fsck on reboot.

That’s all you are done.

One Response to 'What is e2fsck and When and How to run/execute e2fsck ?'

  1. My cousin recommended this blog and she was totally right keep up the fantastic work!