Disclaimer: We may earn a commission when you purchase products linked throughout our site.

Check a Hard Drive for Errors on Ubuntu

Identify the correct disk, distinguish SMART and filesystem errors, and decide when to stop testing and recover the data.

If the drive is already disappearing, making unusual noises or throwing repeated I/O errors, stop unnecessary reads and writes. Decide whether to use a recovery specialist or make a recovery copy with ddrescue before attempting repairs. Filesystem damage and failing hardware can produce similar errors, but a repair to the filesystem cannot repair damaged media.

Identify the physical disk

Use lsblk -o NAME,SIZE,MODEL,SERIAL,FSTYPE,MOUNTPOINTS to match a device by size, model and current mounts. A partition name such as /dev/sdb1 identifies something different from its parent disk. Paths can change on the next boot or when a USB device is moved. Check the name each time.

Check device health separately from the filesystem

In GNOME Disks, select the physical disk and look for SMART Data and Self-Tests where supported. On systems with smartmontools, use sudo smartctl -a /dev/DEVICE with the whole disk name you identified. A USB enclosure may hide SMART access. A drive can also report a passing overall result while kernel logs show read errors. Check journalctl -k -b for errors affecting that device and compare the timing with the failure you observed. See the smartctl manual for device-specific behaviour.

Avoid write-mode bad-sector scans on any drive that contains data you want. For a healthy disk with suspected filesystem damage, use the documented checker for the actual filesystem, with the target unmounted where required. For a failing disk, work on a good copy first. See mount and filesystem recovery to identify the target and separate a mount error from a drive error.