How to do it...

The user interface to smartmontools is the smartctl application. This application initiates tests on the disk drive and reports the status of the SMART device.

Since the smartctl application accesses the raw disk device, you must have root access to run it.

The -a option reports the full status of a device:

    $ smartctl -a /dev/sda

The output will be a header of basic information, a set of raw data values and the test results. The header includes details about the drive being tested and a datestamp for this report:

    smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-  
    642.11.1.el6.x86_64] (local build)
    Copyright (C) 2002-12 by Bruce Allen,    
    http://smartmontools.sourceforge.net

    === START OF INFORMATION SECTION ===
 Device ...

Get Linux Shell Scripting Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.