How to check bad blocks on Linux Server

To avoid any hdd failure, its always better to check the hard drive once in every month or if you are receiving the hard drive failure E-mail alerts then run the following command to test hard drive. For example if you are using the hard drive failure notification for the partition /dev/sda1 then run the following command.

root@server [~]# badblocks -v -v /dev/sda1

After running above command it will show you following running scanning result

root@server [~# badblocks -v -v /dev/sda1


Checking blocks 0 to 5116671
Checking for bad blocks (read-only test):           42496/        5116671

If nothing found out faulty on hard drive, it will show you the following result.

root@server [~]# badblocks -v -v /dev/sda1
Checking blocks 0 to 5116671
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found.

About Anant 384 Articles
Senior technical writer