レナート   TBFKAYIBYNYAAYB   ﻟﻴﻨﺎﺭﺕ

Tue, 01 Jul 2008

Being Smart

Last weekend I set myself the task to write an ATA S.M.A.R.T. (i.e. hard disk health monitoring) reader and parser. After spending some time reading all kinds of T13 and T10 docs and a bit of hacking I now present you the following new software:

Why? You might ask what the point of all this stuff is where smartmontools already exists. What I'd like to see on future GNOME desktops is that as soon as a disk starts to fail a notification bubble pops up warning the user about this fact, and suggesting that he makes backups and replaces the disk. For a tight integration into the desktop, a S.M.A.R.T. implementation that is small, and not C++, and a library (i.e. embeddable into other software with a sane interface) is highly preferable. Also, stuff like distribution installers should link against libatasmart to warn the user about old, and defective disks before he even starts the installation on them. (Hey, anaconda developers! That means you! It's a tiny library, and all you need to do is a single call: int sk_disk_smart_status(SkDisk *d, SkBool *good);)

Please note that I certainly don't plan to replace smartmontools. libatasmart will always implement only a subset of S.M.A.R.T. If you want the full set of functionality then please refer to smartmontools.

Where's this going? I plan to fully maintain libatasmart (including skdump and sktest) for the future. However g-d-h and g-d-h-s will probably just bitrot in my repository -- unless someone else wants to pick this up and maintain it. The reason my further interest in those tools is rather limited is that for the long run we will hopefully will see davidz's DeviceKit-disks (screenhot) changed to use this library for health monitoring. Then DK-d will export the S.M.A.R.T. info on the bus, and a separate daemon would not be necessary anymore. DK-d provides a single interface for all kinds of health parameters for storage, including RAID health and suchlike. I thus think this is the way forward and not g-d-h-s. (That should, of course, not hinder anyone to step up and take up maintainership of g-d-h/g-d-h-s if he wants to. There might be good reasons for doing so. Maybe because you need something to do, or because you want a S.M.A.R.T. solution for the desktop now, and not wait until DeviceKit gets pushed into all the distros).

So, here's where you can get this stuff:

git://git.0pointer.de/libatasmart.git

git://git.0pointer.de/gnome-disk-health.git

Browse the GIT repos.

I will roll a 0.1 tarball of libatasmart soon. I'd be thankful if people could run skdump on their disks and check if its output is basically the same as smartctl -a's. Especially people with BE machines.

Of course the most important part of a software announcement is always the screenshot:

Smart-Ass!

return -ETOOMANYDOTS;

posted at: 23:43 | path: /projects | permanent link to this entry | 15 comments


Posted by Jeremy Katz at Wed Jul 2 00:12:37 2008
I'm not against using this information, but

a) it might be nice if it were just exported by hal so that we wouldn't have to link to and keep up with yet another library; but we can deal if not I guess

b) Filing something in bugzilla rather than just an off-hand comment in the middle of a blog post is far more likely to actually get movement

Posted by Lennart at Wed Jul 2 00:16:10 2008
davidz's DeviceKit is kind of the sucessor to HAL. Hence you will kind of get this in HAL.

Posted by Chris at Wed Jul 2 00:46:33 2008
Great :)
I really look forward to have the HD-Error-Bubbles in the future. Well, I'd rather not see them, but I like the idea of proper dbus integration a lot. Thanks!

Posted by Anon at Wed Jul 2 00:50:11 2008
Awesome, awesome, awesome. Now we just need one of these monitors for software raid (and hardware raid for those fancy desktops) and we're just about set.

Tie in key indicators of disk failure and provide an emergency external disk backup solution and we're away (although it's a shame about SMART and USB devices).

Posted by Ted Percival at Wed Jul 2 05:18:04 2008
ETOOMANYDOTS? I never bother typing the dots because I don't want to spend 10 minutes bouncing on the keyboard every time I have to type out an acronym. That's what capitals are for. Acronyms are meant to save time, especially phonetic ones like SMART.

Meanwhile, back at the point, this sounds really good. It's always weird telling someone that they should set up their local email service so their computer can email them when something goes wrong. I've seen the "disk full" notification dialog a few times and it's really nice to be notified of that kind of problem before something actually breaks.

Posted by foo at Wed Jul 2 09:01:47 2008
smart-notifier already exists.

Posted by Patrys at Wed Jul 2 12:15:22 2008
And proper Nautilus integration of the health status window!

Posted by ivano at Wed Jul 2 12:34:16 2008
gnome-disk-health doenst compile


valac --save-temps -g -o gnome-disk-health-service --vapidir=. --pkg=atasmart --pkg=hal --pkg=dbus-glib-1 --Xcc="-I/usr/local/include  -L/usr/local/lib -latasmart  " gnome-disk-health-service.vala
gnome-disk-health-service.vala: In function ‘_dbus_disk_api_getAttributes’:
gnome-disk-health-service.vala:89: warning: passing argument 2 of ‘disk_api_getAttributes’ from incompatible pointer type
gnome-disk-health-service.vala:89: error: too few arguments to function ‘disk_api_getAttributes’
gnome-disk-health-service.vala: In function ‘_dbus_manager_api_getDisks’:
gnome-disk-health-service.vala:96: warning: passing argument 2 of ‘manager_api_getDisks’ from incompatible pointer type
gnome-disk-health-service.vala:96: error: too few arguments to function ‘manager_api_getDisks’
gnome-disk-health-service.vala: In function ‘disk_open’:
gnome-disk-health-service.vala:237: warning: passing argument 2 of ‘sk_disk_identify_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_populate_attributes’:
gnome-disk-health-service.vala:266: warning: passing argument 2 of ‘sk_disk_smart_parse_attributes’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getIdentifySerial’:
gnome-disk-health-service.vala:307: warning: passing argument 2 of ‘sk_disk_identify_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getIdentifyFirmware’:
gnome-disk-health-service.vala:316: warning: passing argument 2 of ‘sk_disk_identify_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getIdentifyModel’:
gnome-disk-health-service.vala:325: warning: passing argument 2 of ‘sk_disk_identify_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_startSelfTest’:
gnome-disk-health-service.vala:373: warning: assignment discards qualifiers from pointer target type
gnome-disk-health-service.vala: In function ‘disk_real_getOfflineDataCollectionStatus’:
gnome-disk-health-service.vala:397: warning: passing argument 2 of ‘sk_disk_smart_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getTotalOfflineDataCollectionSeconds’:
gnome-disk-health-service.vala:421: warning: passing argument 2 of ‘sk_disk_smart_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getSelfTestExecutionStatus’:
gnome-disk-health-service.vala:430: warning: passing argument 2 of ‘sk_disk_smart_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getSelfTestExecutionPercentRemaining’:
gnome-disk-health-service.vala:462: warning: passing argument 2 of ‘sk_disk_smart_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getConveyanceTestAvailable’:
gnome-disk-health-service.vala:471: warning: passing argument 2 of ‘sk_disk_smart_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getShortAndExtendedTestAvailable’:
gnome-disk-health-service.vala:480: warning: passing argument 2 of ‘sk_disk_smart_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getStartTestAvailable’:
gnome-disk-health-service.vala:489: warning: passing argument 2 of ‘sk_disk_smart_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getAbortTestAvailable’:
gnome-disk-health-service.vala:498: warning: passing argument 2 of ‘sk_disk_smart_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getShortTestPollingMinutes’:
gnome-disk-health-service.vala:507: warning: passing argument 2 of ‘sk_disk_smart_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getExtendedTestPollingMinutes’:
gnome-disk-health-service.vala:516: warning: passing argument 2 of ‘sk_disk_smart_parse’ from incompatible pointer type
gnome-disk-health-service.vala: In function ‘disk_real_getConveyanceTestPollingMinutes’:
gnome-disk-health-service.vala:525: warning: passing argument 2 of ‘sk_disk_smart_parse’ from incompatible pointer type
distcc[30508] ERROR: compile gnome-disk-health-service.c on localhost failed
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)
make: *** [gnome-disk-health-service] Error 1

Posted by Lennart at Wed Jul 2 16:42:36 2008
ivano: try installing vala 0.3.4.

Posted by Laurent at Thu Apr 2 03:20:47 2009
Sounds fairly nice, but:

- I dunno anything about git, and I don't want to know anything about it, I just want a fairly user-friendly way of installing the stuff, that is:
  - either a URL to a downloadable tarball
  - or a repository URL to a Debian and/or RPM package I can get and install through aptitude or rpm

Is this asking too much ? :)

If it is, then tough, I won't bother lookin any further in this stuff...

Posted by JonhK at Thu Apr 9 13:30:10 2009
From your POV, would it be hard to port this lib to Windows ?

Posted by Lennart at Thu Apr 9 14:42:19 2009
JonhK: Depends what you mean by "hard"? All you have to do add one or two functions for the low-level IO with the hard disks on windows. But quite frankly I have no clue about Windows programming, so I cannot help you any further. Happy to take patches though.

Posted by James at Wed Dec 16 07:21:38 2009
http://bugzilla.kernel.org/show_bug.cgi?id=14583

Posted by Paul Wise at Sun Dec 20 05:31:57 2009
Please add support for SATA devices in USB enclosures. smartmontools/smartctl already has support for this. Actually, why don't you work with smartmontools upstream to convert their code into a library???

Posted by Max Waterman at Thu May 13 14:29:19 2010
I see you don't want support/bug reports here...fair enough. Can you say where they should go? tnx

Leave a Comment:

Your Name:


Your E-mail (optional):


Comment:


As a protection against comment spam, please type the following number into the field on the right:
Secret Number Image

Please note that this is neither a support forum nor a bug tracker! Support questions or bug reports posted here will be ignored and not responded to!


It should be obvious but in case it isn't: the opinions reflected here are my own. They are not the views of my employer, or Ronald McDonald, or anyone else.

Please note that I take the liberty to delete any comments posted here that I deem inappropriate, off-topic, or insulting. And I excercise this liberty quite agressively. So yes, if you comment here, I might censor you. If you don't want to be censored your are welcome to comment on your own blog instead.


Lennart Poettering <mzoybt (at) 0pointer (dot) net>
Syndicated on Planet GNOME, Planet Fedora, planet.freedesktop.org, Planet Debian Upstream. feed RSS 0.91, RSS 2.0
Archives: 2005, 2006, 2007, 2008, 2009, 2010

Valid XHTML 1.0 Strict!   Valid CSS!