Tutorial to check bad sectors in Linux using various command-line tools.
There are plenty of command-line tools available in Linux to check bad sectors or bad blocks on Harddisk. It’s better to check bad sectors or bad blocks in your Harddisk to avoid any future damage or data loss.
Note: If you want to fix the bad sectors or bad blocks, you need to be extra careful as it might crash your disk.
Commands To Check Bad Sectors On Hard Disk In Linux
Let’s start with the badblock command to check bad sectors on the hard disk in Linux. Run the following command to check the bad blocks in Linux. It is by default set to run in non-destructive read-only mode.
sudo badblocks -s /dev/sdb1
sudo badblocks -sb 1024 /dev/sdb1
sudo badblocks -sc 64 /dev/sdb1
In the second method, we are going to use smartmontools to check the bad sectors in the HDD. At first, you need to install this tool. For Ubuntu and Debian based Linux, run the following command:
sudo apt install smartmontools
Now, run the following command to check the health status of your drive.
sudo smartctl -a /dev/sda
If you want to try the GUI based disk management tool or disk scanning tool then you can go with the Linux GNOME Disk Management Utility tool along with the Gparted.