I have purchased a new HDD for my backups. Before entrusting the device with the job of keeping my data safe I want to make sure that it is in good condition. The drive is a new internal 3.5 inch SATA drive.

I started a destructive write test with badblocks using the following command.

(Important: DON'T just copy paste the following command it will erase all data on your disk)

# badblocks -wsv -t random /dev/<device>

After ~ 1:30h the badblocks run has reached 0.36% completion. iotop reports average writespeeds between 1.6 and 2.5 MB/s which is about 1% of the write speed the drive should actually be capable of. The IO load reported by iotop is 99.9% though.

Is there something odd going on or is it really common for badblocks to perform that slow?

  • BTW: I suggest iostat -kx 10 as a nice way to monitor I/O. – derobert May 17 '15 at 14:57

You need to add the -c option to do more than 64 blocks and probabky -b to specify a block size other than 1KiB. Right now you're doing 64KiB at a time, which is a lot of seeks.

Something like:

badblocks -c 2560 -b 4096 -wsv -t random /dev/«device»

ought to run much faster. That's 10MiB (= 4KiB × 2560) at a time; go higher with -c if that's still not running full-speed. Also your disk likely has 4K sectors, hence the -b 4096. Otherwise one bad sector will be reported as 4.

(You may wish to consider in addition—or even instead—smartctl -t long. And of course mirror your backups if you're paranoid.)

  • Your suggestion works perfectly, thanks for the hint! Considering the block count parameter "-c" I found the sweet spot for my drive is around 8192 (block size is 4KiB as you assumed) resulting in chunks of ~ 32MB which is 1/4th of the drives cache. If anyone else runs into this problem 0.25*Cache size might be a good reference value to start with. Concerning smartctl - I was going to use this too, but AFAIK smartctl will not (necessarily) detect bad sectors unless data has been written to them before. So my plan is to run the long smart test after a full badblocks run. – norritt May 17 '15 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.