Mark Bad Blocks Check Hard Drive Linux
Which disk?
sudo fdisk -l
Non-destructive read-write test
If you want to preserve your data try this first
sudo badblocks -svn /dev/sdb
smartmon
Check to see if your fix worked
sudo apt-get install smartmontools
sudo smartctl --all /dev/sdb
sudo smartctl -A /dev/sdb
sudo smartctl -a /dev/sdb | grep -i reallocated
Use DD to automatically mark bad blocks – destructive
if you are OK wiping the drive, this seems to be the easiest method
sudo dd if=/dev/zero of=/dev/sdb bs=512k
Use badblocks and fdisk to remove bad blocks
Step 1 – save bad blocks to file
sudo badblocks /dev/sdb > /home/bad-blocks
Step 2 – mark bad blocks with fdisk
sudo fdisk -l /home/bad-blocks /dev/sdb