What is SMART?
No, not a 60's TV series, but a self-test and diagnostic facility – Self-Monitoring, Analysis and Reporting Technology to be exact – that you may not even know you have, built into each and every hard disk unit on your network. See the TechWorld RTFM article on SMART technology for more information.

What Does It Do?
In essence, the drive firmware monitors a range of possibly diagnostic drive parameters, things like the number of seek errors and the disk spin-up time (exactly what is monitored varies from drive to drive – the manufacturer will only implement those diagnostics that are meaningful for the particular drive's architecture). If these parameters degrade over time it may indicate the unit is heading for a breakdown.

Do My Disks Have It?
Yes. Unless you're running DOS applications on an original PC fitted with a 20MByte house-brick, every disk unit on your network has SMART-enabled firmware. SMART has been in the public domain since 1995 and more or less universal since the late 90s. That includes all modern ATA/IDE, SCSI, FC and even SSA hard drive units.

Do I need it?
Yes. The disk manufacturers estimate that about 70% of all drive failures can be predicted by SMART monitoring. With a few days warning of an impending disk failure you'll have a chance to move the files and/or replace the unit before you lose any data. Without it, the first you'll know of a problem will be when you try to print the report you spent all morning drafting and get a message saying "Disk error: Abort, Retry, Fail?".

OK I'm sold – how do I use it?
SMART-enabled disks collect data passively. If you want to monitor them you'll need software that queries the disks at regular intervals. The options are to buy a commercial product, adapt a public domain application or add SMART monitoring to an existing program.

There are plenty of commercial products. Writing an application to retrieve SMART status information from a drive is, as we shall see, easy and any number of small software vendors have seen it as a good niche.

Examples include:

(a) HD Workbench from Dutch-based DIY DataRecovery, priced at $20 per computer, runs on Windows 2000 and XP. It has a neat, clean user interface and includes a number of data-recovery features beyond simply monitoring SMART reports, such as disk cloning, bad sector remapping and a raw disk copy.

(b) ActiveSMART from Ariolic Software runs on Windows and is priced at $25 for a single licence for home use and $40 for a single-computer corporate licence. What you get for the extra $15 isn't clear. The GUI is neat and easy-to-use. The standard product is restricted to ATA/IDE disks; a SCSI version costs $40.

(c) SANtools offers the GUI-based SMARTMon for Windows and a command-line version, SMARTMon-UX, for Unix and Linux, priced at $90 per computer. A cut-down version for personal use is available for $20. Read TechWorld's review for more.

I have a Unix/Linux system – can I do-it-myself?
Yes. In fact it's astonishingly easy. The truth is Unix systems programming is nowhere near as difficult as most people believe. On the whole, writing a decent GUI is far harder.

To get an idea how easy querying a SMART-enabled disk is under Unix and Linux, download the source of SMARTsuite (try www.linux-ide.org). This neat little utility does everything you'd want by way of monitoring both ATA/IDE and SCSI disks, in just a couple of thousand lines of uncomplicated 'C'. It's written for Linux but porting it to most Unix flavours shouldn't involve much more than changing a few #define's in the header files.

Digging into the code, ultimately everything's done through Unix ioctl() system calls. If you haven't already encountered ioctls you're in for a pleasant surprise – they provide a simple and flexible mechanism to allow applications programs access to hardware-specific capabilities and are amongst the most powerful and useful of Unix/Linux system programming services. If you really want to understand Unix I/O a few hours browsing the ioctl man pages and reading the header file sys/ioctl.h (usually in /usr/include) will be time well-spent.

SMARTsuite is distributed under the GNU Public License, so feel free to borrow or adapt its ideas in order to add SMART monitoring and reporting to existing utilities.

I have a Windows system – can I do-it-myself too?
Ah… I had hoped you wouldn't ask that. Yes, you can but it's not quite as straightforward. Those nice folk in Redmond don't want to encourage people to think programming is easy.

Windows also uses the term IOCTL but it means something different; here an IOCTL is a control code – in essence, a number identifying an operation. There are three SMART IOCTLs defined in the WINIOCTL.H header file:-

SMART_GET_VERSION to check the SMART driver version number
SMART_RCV_DRIVE_DATA to receive data from a SMART-enabled drive
SMART_SEND_DRIVE_COMMAND to send data to it

Communication with the device driver goes through a cumbersome function, DeviceIoControl(). The following code illustrates its use.


int main (int argc, char **argv)
HANDLE disk0;
DWORD retCount;

/* get a handle for physical disk 0 (the C: drive) */
if ((disk0 = CreateFile (
printf ("Unable to open physical device 0\n");

/* query the drive for the SMART version it supports */
if (! (DeviceIoControl (disk0,
printf ("DeviceIoControl() call failed\n");
printf ("Driver version... %1d\n"
"Revision......... %1d\n"
"Device map....... 0x%02x\n"

/* close everything & go home */
CloseHandle (disk0);

So there you are, everything you need to know to get S.M.A.R.T. – good hunting!