Monday, March 11, 2013
11:30 AM

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

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.

0 comments:

Post a Comment