2

I'm using smartd to monitor the S.M.A.R.T. health of the internal hard drives on my file server and alert me to signs of impending doom. I would also like to monitor the external eSATA hard drives I'll be using with it, but I'm not sure how to overcome these obstacles:

  1. Being an external drive used for off-site backup, it may or may not be present. How can I make smartd not "freak out" and spam my e-mail inbox when the drive "disappears"? (Note: I haven't tested this yet, but I'm assuming smartd will assume a catastrophic failure of the drive if it suddenly can't be found.)
  2. For the same reason as above, the drives won't always be e.g. /dev/sdf (in fact, once I remove the USB HDD that's currently connected, the next time I connect one of them it will be /dev/sdg!), but it's my understanding that by-UUID and friends reference partitions, whereas I need to reference devices for smartd. How can I reliably point toward these external drives without having to manually update the /dev/sd* reference each time it's plugged in?

Using DEVICESCAN in the config file seems the obvious choice, since I am using identical configurations for all my drives anyway, but it's my understanding that smartd only scans devices when it starts up, and I'd rather avoid having to restart the daemon every time I plug in one of the drives (unless this is the most elegant solution to the problem).

Kromey
  • 3,621
  • 4
  • 24
  • 30
  • Good question, though I think the functionality you're looking for plain doesn't exist yet, and you'll have to cobble something together (like restarting the daemon every time you plug/unplug a drive). – Chris S Apr 22 '11 at 03:06
  • @Chris Well, shucks. I was afraid of that. Oh well, I do have some theories that *may* work, but I'm doubtful. I guess restarting the daemon (and using DEVICESCAN) isn't that big a deal, as I'm going to have to manually mount (and decrypt) the drives anyway when I connect them. – Kromey Apr 22 '11 at 17:57

1 Answers1

1

You should be able to achieve what you need with udev rules.

You could create /dev symlinks to provide consistant access to your external drives (as identified by serial/model/etc). Those could then be referenced in the smartd config and marked with -d removable to ensure smartd starts up when the external drive is absent.

You may still need to restart smartd, but udev can do that too via the RUN directive.

baptr
  • 56
  • 1
  • Wow, completely forgot about this question... In fact, I did end up with a udev rule that simply restarts smartd every time a new device is connected, or one is disconnected. However, I like your idea with symlinks and the removable flag, so I may explore that option in more detail. – Kromey Dec 05 '11 at 19:47
  • While this answers the question of getting smartd to find new disks, it doesn't solve the spam of email you get when removing disks: SMART error (FailedOpenDevice) detected on host: ... The following warning/error was logged by the smartd daemon: Device: /dev/sdc [SAT], unable to open device – Peter Feb 19 '13 at 10:01