I may be misunderstanding some concepts here, but as far as I know, each disk has a partition table and actual partitions.

I'm looking to test a hard drive for bad sectors and errors, but the tools I found to do this are meant for partitions -- not disks. badblocks takes a partition /dev/sda1 not /dev/sda. Same story with e2fsck.

As far as I understand, those tools only test space assigned to partitions, not a whole disk. Is there any way to test an entire disk?

1 Answer 1


Is there any way to test whole disk?

Yes, using badblocks:

badblocks /dev/sda

The manpage refers to partitions because badblocks can tell mkfs.ext2 about the bad blocks it finds, and that only works when checking partitions. But badblocks itself works fine on full disks.

However badblocks is really a relic of a bygone era when hard drives didn’t manage their bad blocks themselves. Nowadays drives track errors themselves and are capable of remapping bad sectors as circumstances allow (typically, when a bad sector is rewritten). You’re probably better off running SMART tests and checking the results:

smartctl -t long /dev/sda
smartctl -t offline /dev/sda
smartctl -x /dev/sda

(make sure each test completes before running the next one).

  • 1
    I get badblocks invalid starting block (0) error on this. Found on internet its due I did not supply partition.
    – Gacek
    Jan 19, 2020 at 15:23
  • @Gacek Just omit the first_block argument. badblocks will start from the beginning of the disk by default.
    – user313992
    Jan 19, 2020 at 15:26
  • 3
    @Gacek It's not mentioned anywhere in the badblocks manpage that it only works with partitions, but not full disks. With that being said, I would not rely on badblocks: I just run it on an old broken disk both in its read-only and in its read/write mode and it was NOT able to find any bad blocks; but running an actual OS on it failed almost immediately -- it probably has to do with the real-life access pattern which badblocks doesn't try to emulate.
    – user313992
    Jan 19, 2020 at 15:32
  • 1
    Modern drives hide badblocks. I thought you need to ask SMART, to tell you the health of the device. Does badblocks talk to SMART? Jan 19, 2020 at 18:15
  • 1
    @ctrl-alt-delor they hide them up to a point — a failed block will still cause read errors. badblocks doesn’t talk to SMART. Jan 19, 2020 at 19:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .