1

I am writing a C program to scan hard drives using ATA read-verify(0x40) command on Linux, like what MHDD's scan does on DOS.

I issue the command using HDIO_DRIVE_TASK, and measure ioctl's block time using CLOCK_MONOTONIC.
I run the program as root, and have its ionice set to real time, but the readouts are always larger than what MHDD shows. Also, MHDD's result don't change a lot, but my program's result often vary a lot.
I try to issue the command twice for each block and measure the block time of the second run. This fixes part of the problem, but my results still vary a lot.

What factors may slow down my command? How should I avoid them?

P.S. I have some spare drives with different health for testing use.

  • Perhaps what MHDD displays is not the values for each individual block, but a sliding average over the last N blocks for some value of N... – twalberg Feb 26 '15 at 15:46
  • Well, I tried to operate on single blocks on MHDD, its output is still stable. – David Gao Feb 27 '15 at 03:03

0 Answers0