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.

[[email protected] ~]# umount  /dev/sda1

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

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

Sachin Saturday 05 October 2013 - 07:36 am | | Default

No comments

(optional field)
(optional field)

Comment moderation is enabled on this site. This means that your comment will not be visible until it has been approved by an editor.

Remember personal info?
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.