HDD Burn In with Python

David M. Wilson dw-google.com at botanicus.net
Tue Dec 30 17:28:25 CET 2003

hokiegal99 at hotmail.com (hokiegal99) wrote...

> I have Macs, Windows and Linux PCs. I'd like to have a generic HDD
> burn in program to test new drives on all platforms. I know Python is
> portable enough to handle the platform differences, but would it be a
> good language for this type of application? The process would involve
> lots of reads and writes all over the drives for an extended period of
> time (several hours). Anybody else done something similar to this? Any
> suggestions?

Properly burn-in testing a hard drive via lots of seeks, reads, and
writes etc. is something I wouldn't have thought Python was
particularly applicable to. The problems I can see here are:

- Python can't provide uniform low-level access to your disks. You can
use the os module, or write your own uniform disk module, which would
possibly be more effort than it was worth.

- Using the os module to create a massive file, then doing seeks,
reads, and writes around in it is not my idea of a good solution to
the problem. You are also then including the underlying operating
system's filesystem layer which will almost certainly be doing all
manner of caching and additional journalling which you can't control.

- Once you've solved the problem of uniform low level access in a
'disk' module,  you also have the problem of ensuring that data
actually hits the disk. The disk has buffers, and the os has buffers.

If your targets are only *NIX/x86 and OS/X, then you are at least
confined to a unix-style environment, which makes getting low-level
disk access easy and the only problem is working out device file
names. I'm not sure how fsync() works on file descriptors open on
device files, but at a guess, I think you're going to have to try
harder to make sure the data actually hits the disk (ioctls?).

I don't think the problem is even confined to making sure writes hit
the disk. You may have problems with the operating system caching
reads too.

Are the disks IDE-based? 99.9%+ of all modern drives manufactured have
SMART capability, which has a lot of disk tests built into it,
although I don't think it has the ability to do thorough write tests.

On top of that, if you are expecting to use the burn-in tests for
benchmarking too, the results you'll get will probably not represent
the true performance of the drive in a platform-neutral way.



More information about the Python-list mailing list