Packetwatch.net

Smartmontools in pfSense



Last modified: May 15, 2012

Contents
1 - Summary
2 - Dependencies
3 - Service configuration
4 - Smartctl examples
5 - Service check


1 - Summary

This guide will show you how to enable smartmontools in pfSense. The smartctl
and smartd binaries are included by default. Smartmontools can run tests to
monitor the SMART of hard disks. This has been tested in pfSense 2.0.1 i386
using ATA hard drives.


2 - Dependencies

Log into the pfSense website. Navigate to the System menu, then click on
Advanced. Click on the box next to Enable Secure Shell. Click on Save at the
bottom of the page.

Enable Secure Shell
Make sure that msmtp with TLS is already copied in and configured. Msmtp is an SMTP client used to send email We will use it to send email notifications. SSH in as the admin user and select option 8 to get to the shell. It's helpful to know what type of hard disk the computer has. You can find this out by typing the following. # sysctl kern.disks kern.disks: ad0 In this case there is a single hard disk which is ad0. Get more information about the hard disk by typing the following. # dmesg | grep "^\ad0" | uniq ad0: 76293MB <WDC WD800BB-75JHC0 06.01C06> at ata0-master UDMA100 Now, with the model of the hard drive find out if it's ATA, SCSI or SAT. 3 - Service configuration Find where the smartmontools daemon is located. # find / -name smartd /usr/local/sbin/smartd Edit /etc/rc so that the smartmontools service will start when the system starts up. Add the following after the line with /etc/rc.start_packages. echo -n 'Starting custom applications:' echo -n ' smartd'; /usr/local/sbin/smartd -p /var/run/smartd.pid echo '.' # cp /etc/rc /etc/rc.original # vi /etc/rc Find where the configuration file should be put. # strings /usr/local/sbin/smartd | grep smartd.conf /usr/local/etc/smartd.conf You can create your own configuration file. Here is a simple example. This will disable Autosave and will schedule a short self-test between 8-9 PM every night and send warnings or errors to the email address provided. Scheduled tests are run after the default scheduled device polling, which by default is every thirty minutes after the smartd service is started. /dev/ad0 -d ata -S off -s S/../.././20 -m notifications@test.com -a # vi /usr/local/etc/smartd.conf Start the smartmontools service. # /usr/local/sbin/smartd -p /var/run/smartd.pid # cat /var/run/smartd.pid 56914 4 - Smartctl examples Here are some basic examples of things you can find with smartctl. This command enables SMART on the hard disks. # smartctl -d ata /dev/ad0 -s on smartctl 5.41 2011-06-09 r3365 [FreeBSD 8.1-RELEASE-p6 i386] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF ENABLE/DISABLE COMMANDS SECTION === SMART Enabled. This command prints the device model number, serial number, firmware version, and ATA Standard version/revision information. # smartctl -d ata /dev/ad0 -i smartctl 5.41 2011-06-09 r3365 [FreeBSD 8.1-RELEASE-p6 i386] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF INFORMATION SECTION === Model Family: Western Digital Caviar Device Model: WDC WD800BB-75JHC0 Serial Number: WD-WCAM95189247 Firmware Version: 06.01C06 User Capacity: 80,000,000,000 bytes [80.0 GB] Sector Size: 512 bytes logical/physical Device is: In smartctl database [for details use: -P show] ATA Version is: 6 ATA Standard is: Exact ATA specification draft version not indicated Local Time is: Mon May 14 14:11:49 2012 CDT SMART support is: Available - device has SMART capability. SMART support is: Enabled This command prints the SMART health status. # smartctl -d ata /dev/ad0 -H smartctl 5.41 2011-06-09 r3365 [FreeBSD 8.1-RELEASE-p6 i386] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED This command runs a SMART short self test. # smartctl -d ata /dev/ad0 -t short smartctl 5.41 2011-06-09 r3365 [FreeBSD 8.1-RELEASE-p6 i386] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION === Sending command: "Execute SMART Short self-test routine immediately in off-line mode". Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful. Testing has begun. Please wait 2 minutes for test to complete. Test will complete after Mon May 14 14:15:32 2012 Use smartctl -X to abort test. This command lists the log of selftest results. # smartctl -d ata /dev/ad0 -l selftest smartctl 5.41 2011-06-09 r3365 [FreeBSD 8.1-RELEASE-p6 i386] (local build) Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net === START OF READ SMART DATA SECTION === SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 6 Short offline Completed without error 00% 0 - 5 - Service check Reboot your computer. SSH in as the admin user and select option 8 to get to the shell. Check to see that the smartmontools service is running. That's is, now you have smartmontools running in pfSense. # shutdown -r now # cat /var/run/smartd.pid 55671

Last modified: Thu Jan 1 00:00:00 1970 UTC
Packetwatch Research 2002-2024.