Enabling smartd in regular pfsense



  • Necessary disclaimer: Don't blame me if stuff blows up, or doesn't work as expected. This is being tested on a production system I'm running, the rc (automatic start during boot) has not being tested yet.

    Guide:

    1. Diagnostics > Command prompt:
      cp /etc/rc /etc/rc.original

    2. Diagnostics > Edit file:
      Enter /etc/rc in the box and hit Load.

    Find the lines that say:

    # Start packages
    /etc/rc.start_packages
    
    /bin/rm -rf /usr/local/pkg/pf/CVS
    

    Add below them:

    # Customization
    echo -n 'Starting custom applications:'
    echo -n ' smartd'; /usr/local/sbin/smartd -p /var/run/smartd.pid
    echo '.'
    
    1. Diagnostics > Edit file:
      Enter /usr/local/etc/smartd.conf in the box, hit Load. It might say the file doesn't exist, ignore it.
      Enter your parameters in the file, for example mine is:
    /dev/ad0 -S on -o on -H -a
    /dev/ad2 -S on -o on -H -a
    

    If you already have email notifications working:

    /dev/ad0 -S on -o on -H -a -m email@example-domain.com
    /dev/ad0 -S on -o on -H -a -m email@example-domain.com
    

    Hit save.

    1. Diagnostics > Command prompt:
      /usr/local/sbin/smartd -p /var/run/smartd.pid

    2. This should show up in your logs:

    
    Nov 28 09:13:19 	smartd[80006]: file /var/run/smartd.pid written containing PID 80006
    Nov 28 09:13:19 	smartd[80006]: smartd has fork()ed into background mode. New PID=80006.
    Nov 28 09:13:18 	smartd[79726]: Monitoring 2 ATA and 0 SCSI devices
    Nov 28 09:13:18 	smartd[79726]: Device: /dev/ad2, is SMART capable. Adding to "monitor" list.
    Nov 28 09:13:18 	smartd[79726]: Device: /dev/ad2, enabled SMART Automatic Offline Testing.
    Nov 28 09:13:18 	smartd[79726]: Device: /dev/ad2, enabled SMART Attribute Autosave.
    Nov 28 09:13:18 	smartd[79726]: Device: /dev/ad2, not found in smartd database.
    Nov 28 09:13:18 	smartd[79726]: Device: /dev/ad2, ST3402112AS, S/N:9LR1JQ6N, FW:3.BHL, 40.0 GB
    Nov 28 09:13:18 	smartd[79726]: Device: /dev/ad2, opened
    Nov 28 09:13:18 	smartd[79726]: Device: /dev/ad0, is SMART capable. Adding to "monitor" list.
    Nov 28 09:13:18 	smartd[79726]: Device: /dev/ad0, enabled SMART Automatic Offline Testing.
    Nov 28 09:13:18 	smartd[79726]: Device: /dev/ad0, enabled SMART Attribute Autosave.
    Nov 28 09:13:18 	smartd[79726]: Device: /dev/ad0, not found in smartd database.
    Nov 28 09:13:18 	smartd[79726]: Device: /dev/ad0, ST3402112AS, S/N:5LRARDPW, FW:3.BHL, 40.0 GB
    Nov 28 09:13:18 	smartd[79726]: Device: /dev/ad0, opened
    Nov 28 09:13:18 	smartd[79726]: Configuration file /usr/local/etc/smartd.conf parsed.
    Nov 28 09:13:18 	smartd[79726]: Opened configuration file /usr/local/etc/smartd.conf
    Nov 28 09:13:18 	smartd[79726]: Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
    Nov 28 09:13:18 	smartd[79726]: smartd 6.1 2013-03-16 r3800 [FreeBSD 8.3-RELEASE-p11 i386] (local build)
    
    

    If you already have remote syslog enabled and working, the logs will show up on the remote server immediately.

    If anyone has any ideas on how to get smartd to show up on Status > services, please share.

    Edit:
    Half an hour later, after starting a long test on one disk:

    Nov 28 09:43:19 	smartd[80006]: Device: /dev/ad0, self-test in progress, 50% remaining
    Nov 28 09:43:19 	smartd[80006]: Device: /dev/ad0, SMART Usage Attribute: 195 Hardware_ECC_Recovered changed from 46 to 47
    Nov 28 09:43:19 	smartd[80006]: Device: /dev/ad0, SMART Usage Attribute: 194 Temperature_Celsius changed from 33 to 35
    Nov 28 09:43:19 	smartd[80006]: Device: /dev/ad0, SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 67 to 65
    

    Showed up on the remote syslog as well. So far so good.



  • Update: Tested the automatic start up today. Works as expected.