• 1-888-289-2246
  • 24x7x365 Presence

File system check for bad sectors on a drive in Linux


Sometimes our disk has bad sectors or may have errors like an input-output related error or be in a read-only file system. At that time we can use e2fsck which is a file system check utility to check for bad sectors on the disk or to resolve other errors on the disk.

However, mostly we use a e2fsck utility when a drive is in a Read-Only file system or when we want to scan our hard disk for bad sectors.

To run e2fsck in a correct way is necessary, which should be like below:-

Step 1: It is always recommended to scan a file system in single-user mode. So first go to single-user mode.
Step 2: Unmount the partition on which you would like to run it.

[root@localhost ~]# umount  /dev/sda1

Step 3: After this run the e2fsck utility on the system as below:-

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

-y = To auto access yes for all questions.
-v = Verbose mode output
-f = Forcefully

Once the file system check is completed, again mount the drive and then shutdown and start the Linux machine. That’s all.

]]>


Leave a Reply

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