Friday, June 16, 2017

monitoring - Using smartd to monitor eSATA hard drive?



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).


Answer



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.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...