Getting Smartmontools Up And Running On Mavericks . . .

When I teach workshops or consult with a photographer, the question invariably comes up: “What hard drive should I buy?” I always get stuck on this one because even if you know a lot about an individual’s workflow and storage needs, there are no simple answers. In the long run I will probably use this article as a starting point for an extended series on the more general subject of photographer’s storage and backup. But until then one of the very first things I think you should learn is how to test and monitor your existing devices.

Dried Corn

Photographs © George A. Jardine

(Please note that Smartmontools is available for Windows too. but I have not installed or tested it on any Windows machines. If there is enough interest I might try that and write about it. What follows is for Macintosh users.)

You’re probably noticed in the Macintosh Disk Utility, that most external hard drives show up as “Not Supported” under S.M.A.R.T. Status. At least until recently. Apple has heard the call and is finally including native SMART status support for external Thunderbolt drives in Mavericks. I’m not sure yet if all flavors of Thunderbolt support SMART status, but the ones I’ve tested (Pegasus, G-Tech and OWC) do. On both Mountain Lion and Mavericks you can also get SMART status working on most external USB and Thunderbolt drives by installing a bit of software called the SATSMARTDriver, which can be found here:

Please read the README on that page, and pay attention to any warnings or incompatibilities!

(If you are using Mavericks 10.9.2 or later, and you only have Thunderbolt drives, you don’t need to install the SATSMARTDriver to get the full benefit of Smartmontools.)

If you want to add this driver to your system to help it see supported USB drives (or both Thunderbolt and USB drives under Mountain Lion), locate the latest release build, which is currently the SATSMARTDriver-0.8.dmg. Click that link, and on the next page, clicking the View Raw link will download the Mac installer disk image.

Ridge Vineyard Composite

(Be sure to dismount your external drives before you install the SATSMARTDriver, and restart your Mac after installation.)

Once you’ve installed the SATSMARTDriver, what does that give you? Well, not much, if the only thing you’re using is Apple Disk Utility to check your drive’s SMART status. For USB and Thunderbolt drives that do support SMART status, the only bit of information you will get in Disk Utility is a “Passed”, or “Failing” message. This is not very helpful because by the time Disk Utility begins reporting that a drive is “Failing”, it is already pretty far gone.

So the next step is to get the complete report of your drive’s health directly from the drive itself. Which does give you a lot more information. There are at least a couple of apps for the Mac that can do this for you, but under the covers they are simply polling the drive with utilities from Smartmontools anyway, and presenting the report to you using some sort of GUI. You see, the actual report that comes from the drive is a bit obscure, and all these apps really do is filter and format it in various ways in an attempt to make it more intelligible. But none of them are very good, and so using Smartmontools directly from the command line seems like the way to go.

Smartmontools can be a bit tricky to get installed and running, but I think it’s worth it. I also want you to know right up front that Smartmontools is a command line utility, and if you don’t have any experience with the UNIX command line, it’s probably not the answer for you. But if you are familiar with a few UNIX basics and the command line, it’s not terrible difficult. I’ve installed Smartmontools on computers running various versions of OS X going back to Snow Leopard without any crashes or problems. Having said that, I also have to add here that attempting to install and run any command line utility means you are traveling at your own risk. Please don’t even start if you don’t have a fresh, bootable backup of your system (that you’ve tested), or if you don’t feel comfortable using the command line in the Terminal app.

So first, please backup your system. If you don’t know how to create and test a bootable backup of your OS, I would not proceed. Time Machine backups are good, but don’t exactly give you the tools to roll back an installation like this should you need to.

To get started, you first have to have the OS X “Command Line Tools” installed. Getting the command line tools installed is pretty seamless in 10.9.2, but it wasn’t all that easy in 10.9.0 or 10.9.1, and was completely different in Mountain Lion. So if you’re wanting to install Smartmontools on 10.8.x systems, maybe drop a comment here or write me and I’ll outline the differences for you. On 10.9.2 you can just open a Terminal window and type in anything that requires a command line tool, and the Terminal will bounce back a message asking you if you want to install them.

In this case I simply typed in “gcc” (without the quotes) and that did the trick.

Installing Command Line Tools

(GCC stands for GNU Compiler Collection, and typing this in is just a way to see if it’s there. This installation process is also documented in more detail here:

Clicking the Install button should do the trick. Once you read and click to agree to the EULA, the installer does everything for you. When that’s finished you can leave the Terminal window open. You’re going to need it again in just a minute anyway.

Next you want to download and install the Smartmontools utilities. Go to and click the text link that says “Looking for the latest version? Download smartmontools-6.2.tar.gz (791.4 kB)”. (it was 6.2 at the time of this writing. The actual version number and text might have been updated by the time you read this.) Once the smartmontools-6.2.tar.gz file has downloaded, double-clicking it will decompress a folder named smartmontools-6.2. You can do all this right in your Downloads folder if you wish, or decompress the tar file somewhere else. It doesn’t matter where the smartmontools-6.2 folder is for installation.

Now would be a really good time to read the README in the smartmontools-6.2 folder, and the INSTALL file, especially section G on MacOS/Darwin installation.

Now, it’s back to that Terminal window you left open. To install Smartmontools, you first have to “cd” (change directory) into the smartmontools-6.2 folder. Just leave the Finder window open (probably your Downloads folder window) where the un-zipped smartmontools-6.2 folder is. Then switch to the Terminal and type “cd ” (that’s just cd, with no quotes, plus a space). Don’t forget the space after the cd command. Then without switching to the Finder window, just roll your mouse over the smartmontools-6.2 folder and drag it into the Terminal window.

Installing Smartmontools

When you let go of the mouse, the Terminal builds the path for you. Then with the Terminal window active, press Return or Enter. If the smartmontools-6.2 folder was in your Downloads folder, that path might look something like this:

Installing Smartmontools

Next type in the following: “./configure” (That’s a period, a forward slash, and the word configure. No spaces, and no quotes. Just ./configure.) Then press Return. At this point you should see a lot of text going by. Just wait, and when it’s done you’ll be back to your UNIX prompt, which is probably your username followed by a $ (like georgej$) or just a simple $ dollar sign.

When you see your prompt again, type “make”. (just make, no quotes.) Then press Return.

Again, lots of text, and a few moments later you should be back at your $ prompt again. When you see the $ prompt, this time type in “sudo make install” (again…. no quotes), and press Return. sudo is a command that gives you “super-user” authority, and requires your computer password. So this time you’ll see a “Password:” prompt. Type in your password, but don’t let it throw you that you don’t see any bullets or any text when you’re typing, the Terminal does not give you any feedback at this point. Just type in your password, and hit Return.

Once all the text flashes by, and you’re back at your $ prompt, you’re almost ready. One last item. At this point, if you type in a smartctl command your Terminal will likely report back to you: “smartctl: command not found”. And that’s because the Smartmontools are not in your path… so to speak. So the last item is to update your path. At your $ prompt, type this, and then hit return: “export PATH=/usr/local/sbin:$PATH” (no quotes).

Now you should be able to use smartctl commands in Smartmontools. Unfortunately, making the path permanent is a bit tricky. You see, by adding /usr/local/sbin to your path with the export command, you’re only adding it to the current Terminal session, and to make it work every time that you need it requires one more step. I’ve added export PATH=/usr/local/sbin:$PATH to my profile file using TextEdit, and that process is outlined here.

Or, you can just update the PATH variable each time you need to use Smartmontools in a new Terminal window by typing export PATH=/usr/local/sbin:$PATH first. But getting it into your .profile file is pretty easy, and a good idea.

(If you don’t want to use a UNIX text editor, a quick and easy Terminal command to open the .profile file is “open -a TextEdit .profile”. But that won’t work until you have a .profile file! So that’s what the article is good for. Anyway, once you’re in mucking around with your .profile file, you might as well add this line too: alias profile=’open -a TextEdit ~/.profile’. That line makes it easy to open your profile and edit it anytime by simply opening a Terminal window, and typing the word profile.)

If you want more information on how the PATH variable works, try this page.

To see what disks are attached to your system, type “diskutil list” (no quotes). Your disks will be shown as /dev/disk0 (that’s usually the boot disk…), /dev/disk1, /dev/disk2, and so on.

To get the SMART status from /dev/disk2, type in “smartctl -a /dev/disk2”

Now it’s up to you to learn how to interpret the data! I think the best way to do that is to spend a little time on the wikipedia page for S.M.A.R.T. Status: Use the smartctl command on a few different brands of drive mechanism, and you’ll find that each manufacturer supports a slightly different list of SMART attributes. Down near the bottom of a SMART report you’ll find a block of text for “Vendor Specific SMART Attributes with Thresholds”, and that’s where the real beef is. The ones to watch for are usually 5 (Reallocated_Sector_Ct), 10 (Spin_Retry_Count), 196, 197, and 198 (on “sector reallocation events”, “scan errors” and “offline uncorrectable errors”). Each vendor may have different names for these attributes.

Reading the Wikipedia page will give you a pretty good hint at which numbers are meaningful, and remember, each drive manufacturer uses different methods of displaying the values and thresholds, so if you spot any thing other than a “0” in the RAW_VALUE column for any of the attributes listed above, then Googling that attribute for “Seagate” for instance, will usually help you find what the numbers mean for your specific brand of drive.

Thai Monk

Why is it worthwhile installing Smartmontools and then digging into what the reports tell you? Well, because there’s a lot of useful information there! By monitoring when a drive starts reporting that more than a few sectors have been reallocated, or when you start to see any uncorrectable UDMA or CRC errors, it’s probably time to replace that mechanism. And trust me… that will be long before Disk Utility reports the drive as “Failing”.

Posted in Essays, Thoughts & Photos.