18

How does a full read/write surface scan by 'badblocks' differ from the built in SMART Extended self test?

It seems like they are both full surface scans, so why does it take badblocks -vws 3 days to test a 1TB drive, while SMART does it in 2 1/2 hours (at least that's the time estimate smartmon gave me)?

1
  • being more throughout, have you considered using badblocks params "last-block" "first-block" and perform the tests a bit per day? Feb 18, 2019 at 22:51

3 Answers 3

16

The SMART surface test is almost certainly a single, and certainly non-destructive, read pass. As has been pointed out it is also internal to the drive; with the possible exception of minor control data, no data is being passed to or from the host during the test.

On the other hand, badblocks -w makes four passes over the drive, each with one write and one read. That alone accounts for an 8× difference in time taken for the test, plus rotational latency. Since it's software running on the host, all that data needs to be shuffled through the disk interface to RAM and handled by the software (badblocks, in our case).

If we take a worst-case rotational latency of 1× (the disk needs to make one full revolution after writing the data in order to read it back, which is pretty much what you'll see if you like badblocks does first fill the whole disk and then read it all back, rather than doing I/O one physical track at a time which with LBA is nigh impossible), we end up with a worst case (1+1) × 8× = 16× as long needed to complete the operation. 16 × 2.5h = 40h, which is certainly in line with your numbers and still assumes we are dealing with only data storage on the drive and that it is happening as fast as the drive can sustain sequential I/O.

6

The S.M.A.R.T. short and long tests only perform (localized) reads of the sectors; it's also non-destructive to the data. The read data is only transferred to the on-board controller, not to the host PC. The SATA interface is essentially idle during the test, and the HDD activity light on the PC should not turn on.

badblocks -vws is requesting a write sector then read & verify operation. Each write and read adds a disk revolution per operation plus time for data transfers over the SATA interface plus host PC processing. The HDD activity light should be on most of the time.

0

https://wiki.archlinux.org/index.php/badblocks#Comparisons_with_Other_Programs

The caveat here being is that some manufacturers testing programs do not print full test results and allow a certain number of bad sectors saying only if they pass or not. Manufacturer programs, however, are generally quicker than badblocks sometimes a fair amount so.

So use badblocks' destructive thorough tests when possible.

Edit: By destructive I meant that many modern hard drives have an 180TB/y workload, meaning on a 12TB hd, you would be taking 96TB of workload, if you run the full set of badblocks tests just to test it. That might be 48TB if by workload they only mean writes, which might be the case, but it's not well documented.

You must log in to answer this question.

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