smartmontools SVN Rev 5419
Utility to control and monitor storage systems with "S.M.A.R.T."
Smartmontools Sourcecode Documentation

This is the main index page. Here we present a short introduction of the smartmontools software architecture and its components.
Please refer to the further tabs and links to get detailed information on each class and method.

Other Resources


The smartmontools package contains two utility programs (smartctl and smartd) to control and monitor storage systems using the Self-Monitoring, Analysis and Reporting Technology System (SMART) built into most modern ATA, SCSI and NVMe disks.

Smartmontools supports ATA/ATAPI/SATA-3 to -8 disks, SCSI disks and tape devices and NVMe devices. It should run on any modern Darwin (Mac OS X), Linux, FreeBSD, NetBSD, OpenBSD, Solaris, OS/2, Cygwin, QNX, eComStation or Windows system.

Software Architecture

OS Specific Interfaces

Each different port and OS needs to provide it's own interface.
It is meant to isolate the OS dependent parts of the code and to provide a debugging interface.

The following ports currently exist:

Already adapted to new c++ Interface

Still working with old interface

To port smartmontools to the OS of your choice, please:

  1. Contact to check that it's not already been done.

  2. Make copies of os_generic.h and os_generic.cpp called os_myOS.h and os_myOS.cpp.

  3. Modify so that case "${host}" includes myOS.

  4. Verify that ./ && ./configure && make compiles the code. If not, fix any compilation problems. If your OS lacks some function that is used elsewhere in the code, then add a AC_CHECK_FUNCS([missingfunction]) line to, and surround uses of the function with:
    where the macro HAVE_MISSINGFUNCTION is (or is not) defined in config.h.

  5. Now that you have a working build environment, you have to replace the 'stub' function calls provided in this file.

    Provide the functions defined in this file by fleshing out the skeletons below. You can entirely eliminate the function 'unsupported()'.

  6. Wiki page DeveloperHowToMigrate gives detail instructions on how to migrate old os_youros.cpp to new class interface

  7. We also started a page about CodingStyle

  8. Contact to see about checking your code into the smartmontools SVN archive.

Interfaces For The Different Device Types

As the smartmontools have to handle different types of devices, we have multiple device drivers.

The outside view presents only the interface classes:

ATA Devices

In this case we access the device via ATA pass through in native mode.

By the help of ata_device_with_command_set we currently integrate the old os-specific legacy drivers, until they will be replaced by their new implementations of ata_device or scsi_device.

Collaboration diagram for new ATA pass through old interface

SCSI Devices

Here we use the SCSI instruction set.

Collaboration diagram for SCSI devices

NVMe Devices

Here we use the NVME instruction set.

Collaboration diagram for NVMe devices

Tunneling ATA via SCSI

If a controller understands ATA pass through SCSI, we use this driver.

Collaboration diagram for tunneling protocols