Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Install an enhanced SMART monitoring package UNIX
Unfortunately, I've recently had reason to want to check the SMART status of my PowerBook's internal disk. Apple's Disk Utility will tell you a simple pass/fail summary of the SMART status of the disk, but it won't go into any detail, show you logs, or details of particular errors. What's more, I believe that it only looks at certain classes of errors to determing the Verified of Failing status, and so if the drive is experiencing errors, such as its firmware silently remapping sectors, it's still shown as A-OK.

I decided to go hunting for some more useful utilities, and first discovered SMARTReporter which displays an icon in the menu bar showing you a visual status of the disk. This utility, however, appears to use the same criteria as Disk Utility for determining as simple pass/fail status, so in this particular case isn't that useful to me. It is handy in a more general sense as it can monitor multiple disks, and upon a SMART failure it can do any combination of: pop up an alert dialog, execute another program or send emails to multiple addresses.

So, digging a bit deeper, I then found the smartmontools, which consist of smartctl and smartd that together will report on a whole lot of low-level SMART information, including showing the drive's error log, and other useful information. smartmontools run at the command line only, so you do have to delve into Terminal to get at it, but they provide a wealth of information that is difficult, or impossible, to get in any other way. I've got more information on them available in a recent blog posting.

What I'm going to do now is, through a bit of magic with dd and DiskWarrior, to add a line to the daily cron script to check the SMART status of my internal hard disk, and let me know if there are any errors at all, not just something that DiskUtility thinks is worthy.

[robg adds: I downloaded and installed the package (following the "install from source" instructions, and it worked as described -- ./configure, make, and sudo make install installed the package. It seems to work with the SATA drives in the Dual G5, even though the site doesn't make it clear that it will do so.]
    •    
  • Currently 2.80 / 5
  You rated: 3 / 5 (5 votes cast)
 
[29,615 views]  

Install an enhanced SMART monitoring package | 42 comments | Create New Account
Click here to return to the 'Install an enhanced SMART monitoring package' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Install an enhanced SMART monitoring package
Authored by: syko on May 19, '06 08:15:20AM

I installed this a while back and it works quite well.. been using it to test my drives in my dual G5-- it's interesting to see how my stock 250, which 'felt' slower, actually has been climbing up in 'errors'-- errors that aren't reported by DW or Disk Utility, but errors nonetheless that apparently has affected my boot drive.



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: ScottTFrazer on May 19, '06 08:25:27AM

No luck on the MacBookPro SATA drives.

Starting the daemon results in "In the system's table of devices NO devices found to scan"



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: MartySells on May 19, '06 09:48:11AM

I was just playing with this the other day on a linux box to go through all my old hard disks. A few notes:

1. Some drives incorrectly report power on hours as minutes. If you get the latest version then the tools should be know about this in the database.

2. Some vendors SMART implementation is broken and the power on times have too few bits of resolution. The counter reests itself around at 1000 hours. Check the docs for more info.

3. You can get your serial number from the drive. This is very handy to create an inventory of your disks especially if you have multiple identical drives.

-m



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: maxotron on May 19, '06 10:00:07AM

You can install this from darwinports as well I think, if you want the easy life. Not sure if that is the lastest version though.



[ Reply to This | # ]
DarwinPorts version
Authored by: sjk on May 19, '06 08:41:07PM
Not sure if that is the lastest version though.
Unfortunately not, yet. It's still 5.33, Revision 1 and 5.36 is the current stable release.

[ Reply to This | # ]
also available in Fink
Authored by: macubergeek on May 22, '06 02:33:28AM

alas only version 5.33-1



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: DocMan on May 19, '06 10:34:36AM

Can this be used via target disk mode? My Powerbook hard drive has been laid low by I/O errors and now it won't boot. I've yet to find anything that will help me recover the drive enough to determine if it is deceased or just hurting. This has put my primary computer out of commission. My most recent back up is three days prior to when I noticed the problem.

Doc



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: allanmarcus on May 19, '06 11:16:47AM

Probably not. In Target Disk Mode your PB is a firewire drive, and I don't think FW supports SMART.



[ Reply to This | # ]
using SMART to check dead disk in PowerBook
Authored by: WinUser on May 22, '06 04:21:29AM

How about this: Have the 'dead' PowerBook boot from an bootable external (FireWire) drive and start the SMART Monitoring tool from that drive, to check the internal disk...
Haven't tried it, but I'd think it would work.



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: rong on May 19, '06 02:18:31PM

You're out of luck on two points.

1) No, SMART monitoring doesn't work over firewire.

2) This is a *monitoring* tool to assist in knowing when to take a drive out of service *before* it goes bad.

There is nothing in this tool to assist with *recovering* a drive.



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: rong on May 19, '06 02:25:18PM

Also works fine with a SATA WD Raptor hooked up to a Seri-Tek1VE4.

As well as two "Maxtor DiamondMax 10 family" drives hooked up to that same Seri-Tek but with a SATA/IDE adapter being used. (These two drives are PATA, but hooked up to the SATA controller.)

As expected, IDE/PATA drives driven by both the two channel and the four channel ACARD RAID controllers are not seen.



[ Reply to This | # ]
cron jobs and smartd
Authored by: kaih on May 19, '06 06:06:57PM
I hadn't fully finished checking out the smartmontools package when I posted this hint - there's a second component to it all, smartd.
smartd removes the need to have smartctl run from a cron job - all you need to do is ensure that smartd runs at startup, and you modify the conf file appropriately (man smartd)
It will then check, by default, your drives every half an hour and if there's any change in the status, an error will be printed to syslog - viewable with Console.app
The only problem I found with having smartd launch at startup, is that due to the way it's written, you can't launch it using launchd the new OS X Tiger way as upon launching it forks and quits it's parent process, thereby making launchd think it's quitting, whereupon it tries to relaunch it. Once it goes through this 10 times, launchctl removes smartd from the launchd list...

---
k:.

[ Reply to This | # ]

cron jobs and smartd
Authored by: bdm on May 20, '06 01:16:31AM

Make a shell script that starts the daemon then sleeps forever. Install the script for launch at startup instead of the daemon.

Brendan.



[ Reply to This | # ]
cron jobs and smartd
Authored by: mnewman on May 20, '06 04:34:45PM

Could you point us to a resource that explains how to do this?

---
Mike Newman
Saipan and Narita Layover Pages:
http://www.mgnewman.com



[ Reply to This | # ]
cron jobs and smartd
Authored by: bdm on May 21, '06 01:03:31AM
A shell script that does the necessary things would be:

#!/bin/sh
smartd
sleep 99999999
It would be better to use the full path of the smartd executable to avoid path issues. Someone familiar with the process of installing daemons to run at startup, please tell us how it is done; my expertise on that is dated. Apparently Apple does not want us to use rc or SystemStarter like we used to.

Brendan.



[ Reply to This | # ]
And how to disable a bad sector?
Authored by: Ptitboul on May 20, '06 12:44:15AM
Since a few years, there is a bad sector on one of my hard drives. Disk Utility does not report anything, but smartctl says Error 419 occurred at disk power-on lifetime: 13095 hours (545 days + 15 hours) When the command that caused the error occurred, the device was active or idle.
  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 01 3f 13 77 e6  Error: UNC 1 sectors at LBA = 0x0677133f = 108467007

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  c8 00 08 38 13 77 e6 00      18:06:00.600  READ DMA
  c8 00 08 30 13 77 e6 00      18:06:00.600  READ DMA
  c8 00 08 28 13 77 e6 00      18:06:00.600  READ DMA
  c8 00 08 20 13 77 e6 00      18:06:00.600  READ DMA
  c8 00 08 18 13 77 e6 00      18:06:00.600  READ DMA
Do you know if there is some technique to disable this bad sector?

[ Reply to This | # ]
And how to disable a bad sector?
Authored by: Auricchio on May 20, '06 11:42:46AM

The best way would be to read and rewrite the sector. This will allow the drive to remap it. I once wrote a program to do just this. Running as root, it opens the raw drive, does a seek to the sector, reads, then rewrites it.

---
EMOJO: mojo no longer workin'



[ Reply to This | # ]
Installation clarification
Authored by: clh on May 20, '06 04:49:16PM

Just providing some preamble for robg's brief description of installing:

Go to SourceForge's smartmontools page
<http://sourceforge.net/project/showfiles.php?group_id=64297>

Under "Latest File Releases" is smartmontools 5.36 (Apr 12, 2006). Click Download.

Click on the file 'smartmontools-5.36.tar.gz'

On the "Please Select a Mirror" page, choose a server. Download of the gz file should begin.

Un-archive smartmontools-5.36.tar.gz, use Terminal to cd into the directory smartmontools-5.36, and continue with Rob's instrux (./configure, etc.)



[ Reply to This | # ]
And how do I run it?
Authored by: hamarkus on May 21, '06 03:09:32AM

With Brendan's (bdm) question still unanswered, how do I ensure it is run at start-up?

I have installed it successfully but did not touch the configuration file (the program sits in /usr/local/sbin, man smartd works and smartd.conf is there as well). But typing smartd (even when in /usr/local/sbin) only produces
-bash: smartd: command not found

Will it run automatically once I restart the system? Or do I understand Brendan correctly that somebody first has to tell us how make it run at start-up?



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: geppo1982 on May 21, '06 03:49:29AM
I wrote a simple package to install smartmontool precompiled binaries into your /usr/local/bin folder; you can download it from:
http://geppo1982.altervista.org/smartmontools_5.36.dmg.tgz
(copy and paste this link into your browser address bar, do not direct click on it).


If you do not have a /usr/local/bin folder you can create it entering the following command into Terminal:
sudo cd /; mkdir usr; mkdir usr/local; mkdir usr/local/bin

To launch smartd open ScriptEditor and paste the following code:
set mailAddress to "youremailaddress"
set mainDisk to do shell script "mount | grep \" on / \" | cut -d \" \" -f 1"
do shell script "echo " & mainDisk & " -n standby -T permissive -s L/../../7/09 -H -l selftest -l error -f -m " & mailAddress & " | /usr/local/bin/smartd -c - -i 3600"
Then substitute youremailaddress with your real e-mail address (smartd will send you and e-mail when it will detect a new error on your disk) and save the script as "application".

If you want to launch smartd at startup add the application you created to your Login Items.

[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: hamarkus on May 21, '06 10:14:48AM

Thanks for the binary. Running smartd from the command line now works.

The Applescript, unfortunately, gives me an error on compiling:
"expected end of line but found ..." , essentially it expects an end of line after the "mount | grep " part.



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: geppo1982 on May 21, '06 11:01:26AM
Download the applescript application here:
http://geppo1982.altervista.org/Launch_smartd.tgz
Then open it with Script Editor, replace youremailaddress with your real e-mail address and save.

I hope it will work.

[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: hamarkus on May 21, '06 12:46:49PM

Thanks, it works fine now.
There was just one quirk. In the folder created by expanding the .tgz archive, two files were present. One named 'Launch smartd.1.app' and the second 'Launch smartd.app'. The former, the compiled script I presume, insisted on launching Classic, which I do not have installed. The second, the uncompiled script I would guess, could be opened with Scripteditor and saved as an application from there.



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: smkolins on May 21, '06 12:52:07PM

great progress is making this usable.

Some suggestions - I'm not sure but perhaps it needs to be built as a universal binary, and include the man files in usable form - or make a GUI wrapper around the whole thing so that average users can configure it?

I'm not a programmer but I am a sysadmin of a school system and getting warnings on drive failing seems like a very good idea - though I wonder how the email warning would work - where's the smtp connection?

---
Possess a pure, kindly, and radiant heart!



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: geppo1982 on May 21, '06 03:02:14PM
I don't now how smartd sends e-mail but you can check if this feature works on your system by entering the following command in Terminal and then checking your mailbox.
maindisk=`mount | grep " on / " | cut -d " " -f 1`; \
echo $maindisk -m youremailaddress -M test | \
/usr/local/bin/smartd -c - -q onecheck
Remember to change youremailaddress with your real e-mail address.

[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: hamarkus on May 22, '06 02:07:48AM

I get the following message when I try this:

Test of mail to xxx@xxx produced unexpected output (78 bytes) to STDOUT/STDERR:
postdrop: warning: unable to look up public/pickup: No such file or directory



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: geppo1982 on May 22, '06 05:41:37AM

On my PowerBook with a fresh Tiger (10.4.6) intallation this command works well. What's your OS version?



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: hamarkus on May 22, '06 06:08:41AM

Tiger 10.4.6 as well (with all sharing services turned off, if that should matter, just guessing what the reference to the dropbox might mean).

So, you actually get an e-mail?



[ Reply to This | # ]
It works!
Authored by: hamarkus on May 22, '06 06:22:01AM

I must have miss-typed something before. When I tried it again, I got the test e-mail. Thanks to the great powers of Unix and to you for your help.



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: mnewman on May 21, '06 04:08:23PM

But, you really don't want it as a login item, do you?

You want it to run when the machine boots up so that that the smartd daemon is running even if no one logs in.

Can you put a compiled Applescript in /Library/StartupItems?

---
Mike Newman
Saipan and Narita Layover Pages:
http://www.mgnewman.com



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: mnewman on May 21, '06 08:32:30PM

I finally got this working as a proper system startup item in /Library/StartupItems.

The binary (shell script) needs to go in a sub-directory in /Library/StartupItems and both the binary and subdirectory need to have the same name. That directory must also contain a valid StartupParameters.plist file. And, you need to set all the permission right (just copy what another startup item has: owner=root, group=wheel, etc.).

(Sorry for the duplicate post, above. Can someone delete it?)

---
Mike Newman
Saipan and Narita Layover Pages:
http://www.mgnewman.com



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: geppo1982 on May 22, '06 06:16:48AM
I wrote another, more complete, installer for smartd and smartctl. This new version of the installer contains a file to launch the smartd daemon at startup (using launchd).
http://geppo1982.altervista.org/smartmontools_5.36.pkg.tgz


[ Reply to This | # ]
Failed to install
Authored by: hamarkus on May 22, '06 06:35:55AM

It says: "There were errors during the installation" "Please try again"

I quit smartd before running the installer. It realised I already had a version of smartd and changed the button from install to upgrade.



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: smkolins on May 22, '06 06:45:56AM

apple+i the /usr/local/bin/ parts and it still says PPC - needs to be a universal binary I think. This might explain the difference between it working on G5 SATA drives and not MacTel SATA drives. I installed the darwinports version which I could see compiled with i386 parts.

---
Possess a pure, kindly, and radiant heart!



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: mnewman on May 22, '06 05:02:49PM

The installer log says that it writes 12 files. What are they and where do they go?

---
Mike Newman
Saipan and Narita Layover Pages:
http://www.mgnewman.com



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: geppo1982 on May 22, '06 11:40:31PM
The last installer version contains:
/Library/Application Support/smartd (folder for the smartd configuration file)
/Library/LaunchDaemons/org.smartd.launcher.plist (file needed to launch smartd as daemon)
/usr/local/bin/smartctl (smartctl universal binary)
/usr/local/bin/smartd (smartd universal binary)
At the end of the installation an applescript will ask you for an e-mail address needed for the notification of errors and failures of your hard drive. The address will be written in the /Library/Application Support/smartd/smartd.conf file.

[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: mnewman on May 23, '06 01:08:23AM

Thanks and good work. I've used your installer on two machines now.

One small problem. I've added "-M test" to the end of the active line in the smartd.conf file in order to generate a test e-mail message when smartd first runs.

This works, except that the body of the test e-mail message is blank.

If I run smartd from the command line it generates a test e-mail message with the body in tact:

======
This email was generated by the smartd daemon running on:

host name: Smooch.local
DNS domain: local
NIS domain:

The following warning/error was logged by the smartd daemon:

TEST EMAIL from smartd for device: /dev/disk0s3

For details see host's SYSLOG (default: /var/log/messages).
======

What could cause the body to be blank when smartd is started with launchd?

---
Mike Newman
Saipan and Narita Layover Pages:
http://www.mgnewman.com



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: smkolins on May 24, '06 08:13:38PM

I'ld like to know exactly what URL you used to get the universal binary - I tried this one twice and it's still not universal.

http://geppo1982.altervista.org/smartmontools_5.36.pkg.tgz

---
Possess a pure, kindly, and radiant heart!



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: geppo1982 on May 26, '06 01:16:40PM

On my Mac (G5) the Kind (in the info window) of smartd and smartctl is "Document (Universal)" and I think this means they are Intel ready. Is this wrong?



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: da2357 on Aug 03, '06 09:55:44AM

Would you be willing to share that app with us?



[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: klktrk on Sep 17, '06 03:59:55PM
Downloaded the 5.36 pkg from link in this thread, and it doesn't install launchd plist files at all, but rather installs the an StartupItem style daemon.

Link mentioned is: http://geppo1982.altervista.org/smartmontools_5.36.pkg.tgz

Where can i get the launchd version of this package?

Thanks.

[ Reply to This | # ]
Install an enhanced SMART monitoring package
Authored by: klktrk on Sep 18, '06 11:42:00PM

First, this is NOT what is installed if you download the referenced file. You get an old StartupItem type installation instead of a .plist file installation.

Also, if you are running an Intel Mac, don't expect this to work (at least not on laptops).



[ Reply to This | # ]