Easy Way to Checking Hard Drive for Bad Sectors and Errors in Ubuntu

hard drive bad sector

How to know if you have bad sectors on your hard drive in Ubuntu Desktop and how to fix them. You can use badblock program to fix this problem. The badblocks is program command line based allow to test your harddrive for, you guessed it, bad blocks. The badblocks program is part of the e2fsprogs package, which is installed by default in ubuntu based distro.

To check your harddrive for bad blocks, open the terminal type following command:

sudo badblocks -v /dev/sda1 > bad-blocks-result

After executing the above command it will generate the file bad-blocks-result in the current directory where you are execute this command. Now, you can pass this file to the fsck command to record these bad blocks.

sudo fsck -t ext4 -l bad-blocks-result /dev/sda1

If badblocks reports a block that was already used, e2fsck will try to move the block to another place. If the block was really bad, not just marginal, the contents of the file may be corrupted.

You may also like...

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.