Posts tagged run e2fsck on boot

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 :

[email protected][#] umount partition name

for example :

[email protected][#] umount /dev/sda2

If you encountered a error like :

umount device or resource busy

Then try the below command :

[email protected][#] umount -l partition name

for example :

[email protected][#] 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

[email protected][#] e2fsck -y -v -f partition name

for example :

[email protected][#] e2fsck -y -v -f /dev/sda2

or the safest way is :

[email protected][#] shutdown -Fr now

This will Force fsck on reboot.

That’s all you are done.