badblocks vs. SMART Extended Self Test
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)?
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.
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.