I agree, you wouldn't want two emails about a drive failure.One thing I'm considering is whether to disable the notification email. FreeNAS will notify you anyway if you have email set up (and if you don't, you won't get the email from this script either), so it seems kind of redundant.
Many hot-swap backplanes have disk-failure LEDs that can be turned on when a disk fails. Unfortunately, there doesn't seem to be a standard mechanism to do this, and FreeNAS doesn't have any built-in support for this feature.
Using inspiration from a couple of other sources (and by inspiration, I mean I blatantly ripped off, and tweaked to work with FreeNAS), I've modified a script that will light up the disk-failure LEDs on, at least, Supermicro SAS2 expander backplanes. I don't have any...
rm: glabel-lookup.sed: No such file or directory
I created another file and renamed zpscanz.sh ran it as cron job and it first failed withCurious--it seems to run without issue on my RAIDZ2 pool. What happens if you replace every instance in the script of glabel-lookup.sed with /tmp/glabel-lookup.sed? There should be six places to make this change.
/usr/local/bin/zpscanz.sh: line 26: [: missing `]'
Sending email notification of degraded pool tank Locating failed drives. Locating: da2 5003048-0-006f-72ad LSI Corporation SAS2 IR Configuration Utility. Version 20.00.00.00 (2014.09.18) Copyright (c) 2008-2014 LSI Corporation. All rights reserved. SAS2IRCU: No Controller Found at index 0.
Interesting. What's the output ofSAS2IRCU: No Controller Found at index 0.
sas2flash -listall
?thanks for checking it out! here is the output:Interesting. What's the output ofsas2flash -listall
?
[root@m5_nas ~]# sas2flash -listall LSI Corporation SAS2 Flash Utility Version 16.00.00.00 (2013.03.01) Copyright (c) 2008-2013 LSI Corporation. All rights reserved Adapter Selected is a LSI SAS: SAS2008(B2) Num Ctlr FW Ver NVDATA x86-BIOS PCI Addr ---------------------------------------------------------------------------- 0 SAS2008(B2) 20.00.07.00 14.01.00.08 07.39.02.00 00:01:00:00 Finished Processing Commands Successfully. Exiting SAS2Flash. [root@m5_nas ~]#
For reasons unclear to me, the email logic I'd added seemed to break things, so I've removed it. The script now will send an email when it detects a failure. By default, the email will go to root; if you want it to go to some other address, specify it on the command line:zpscan.sh poolname nobody@example.com
.
rm: /tmp/glabel-lookup.sed: No such file or directory
chmod +x zpscan.sh
to the script inside that folder bash /mnt/tank/scripts/zpscan.sh tank
Shouldn't make a difference, but try taking "bash" out of that command--the script should run on its own.in the cron details, user as root, command bash /mnt/tank/scripts/zpscan.sh tank
Yes!Does it run from the shell with just the script name/path?/path/to/zpscan.sh poolname
?
[root@m5_nas ~]# /mnt/tank/scripts/zpscan.sh little_tank Saving drive list. [root@m5_nas ~]# /mnt/tank/scripts/zpscan.sh tank Saving drive list. [root@m5_nas ~]#
No, it's a system directory--you should be able to confirm that yourself by doingdo the tmp dir needs to be created before hand?
cd /tmp
. When you say:What happens when you try to run them from cron?neither of the 2 scripts work now
by disablingWhat happens when you try to run them from cron?
Redirect Stdout
in the cron job details, here are each of the results received by emailCron <root@m5_nas> PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /mnt/tank/scripts/zpscan.sh little_tank
Saving drive list.
Cron <root@m5_nas> PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /mnt/tank/scripts/zpscan.sh tank
Saving drive list. rm: /tmp/glabel-lookup.sed: No such file or directory
Cron <root@m5_nas> PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /mnt/tank/scripts/zpscan.sh little_tank > /dev/null
rm: /tmp/glabel-lookup.sed: No such file or directory
What are the contents of /root/.sas2ircu/drives-tank?
[root@m5_nas ~/.sas2ircu]# cat drives-tank da7 5003048-0-006f-72b2 da5 5003048-0-006f-72ac da3 5003048-0-006f-72ae da6 5003048-0-006f-72af da4 5003048-0-006f-72b6 da2 5003048-0-006f-72ad [root@m5_nas ~/.sas2ircu]#
What about drives-little_tank?
And also, what's the output ofsas2ircu 0 display
?
[root@m5_nas ~/.sas2ircu]# cat drives-little_tank da1 5003048-0-006f-72b5 2:9 da8 5003048-0-006f-72b7 2:11 [root@m5_nas ~/.sas2ircu]#
sas2ircu 0 display
LSI Corporation SAS2 IR Configuration Utility. Version 20.00.00.00 (2014.09.18) Copyright (c) 2008-2014 LSI Corporation. All rights reserved. Read configuration has been initiated for controller 0 ------------------------------------------------------------------------ Controller information ------------------------------------------------------------------------ Controller type : SAS2008 BIOS version : 7.39.02.00 Firmware version : 20.00.07.00 Channel description : 1 Serial Attached SCSI Initiator ID : 0 Maximum physical devices : 255 Concurrent commands supported : 3432 Slot : 16 Segment : 0 Bus : 1 Device : 0 Function : 0 RAID Support : No ------------------------------------------------------------------------ IR Volume information ------------------------------------------------------------------------ ------------------------------------------------------------------------ Physical device information ------------------------------------------------------------------------ Initiator at ID #0 Device is a Hard disk Enclosure # : 2 Slot # : 0 SAS Address : 5003048-0-006f-72ac State : Ready (RDY) Size (in MB)/(in sectors) : 2861588/5860533167 Manufacturer : ATA Model Number : WDC WD30EFRX-68E Firmware Revision : 0A80 Serial No : WDWCC4NPK6VYZE GUID : N/A Protocol : SATA Drive Type : SATA_HDD Device is a Enclosure services device Enclosure # : 2 Slot # : 0 SAS Address : 5003048-0-006f-72bd State : Standby (SBY) Manufacturer : LSI Model Number : SAS2X28 Firmware Revision : 0e0b Serial No : x365514110 GUID : N/A Protocol : SAS Device Type : Enclosure services device Device is a Hard disk Enclosure # : 2 Slot # : 1 SAS Address : 5003048-0-006f-72ad State : Ready (RDY) Size (in MB)/(in sectors) : 2861588/5860533167 Manufacturer : ATA Model Number : WDC WD30EFRX-68E Firmware Revision : 0A82 Serial No : WDWCC4N2DN6PFH GUID : N/A Protocol : SATA Drive Type : SATA_HDD Device is a Hard disk Enclosure # : 2 Slot # : 2 SAS Address : 5003048-0-006f-72ae State : Ready (RDY) Size (in MB)/(in sectors) : 2861588/5860533167 Manufacturer : ATA Model Number : WDC WD30EFRX-68E Firmware Revision : 0A82 Serial No : WDWCC4NA78JFUH GUID : N/A Protocol : SATA Drive Type : SATA_HDD Device is a Hard disk Enclosure # : 2 Slot # : 3 SAS Address : 5003048-0-006f-72af State : Ready (RDY) Size (in MB)/(in sectors) : 2861588/5860533167 Manufacturer : ATA Model Number : ST3000DM001-1CH1 Firmware Revision : CC44 Serial No : Z1F21ZWR GUID : N/A Protocol : SATA Drive Type : SATA_HDD Device is a Hard disk Enclosure # : 2 Slot # : 6 SAS Address : 5003048-0-006f-72b2 State : Ready (RDY) Size (in MB)/(in sectors) : 2861588/5860533167 Manufacturer : ATA Model Number : ST3000DM001-1E61 Firmware Revision : CC45 Serial No : Z1F295EB GUID : N/A Protocol : SATA Drive Type : SATA_HDD Device is a Hard disk Enclosure # : 2 Slot # : 8 SAS Address : 5003048-0-006f-72b4 State : Ready (RDY) Size (in MB)/(in sectors) : 1907729/3907029167 Manufacturer : ATA Model Number : ST2000DM001-9YN1 Firmware Revision : CC96 Serial No : W24004HR GUID : N/A Protocol : SATA Drive Type : SATA_HDD Device is a Hard disk Enclosure # : 2 Slot # : 9 SAS Address : 5003048-0-006f-72b5 State : Ready (RDY) Size (in MB)/(in sectors) : 953869/1953525167 Manufacturer : ATA Model Number : WDC WD10EAVS-00D Firmware Revision : 1A01 Serial No : WDWCAU43597367 GUID : N/A Protocol : SATA Drive Type : SATA_HDD Device is a Hard disk Enclosure # : 2 Slot # : 10 SAS Address : 5003048-0-006f-72b6 State : Ready (RDY) Size (in MB)/(in sectors) : 2861588/5860533167 Manufacturer : ATA Model Number : WDC WD30EFRX-68E Firmware Revision : 0A80 Serial No : WDWMC4N1866499 GUID : N/A Protocol : SATA Drive Type : SATA_HDD Device is a Hard disk Enclosure # : 2 Slot # : 11 SAS Address : 5003048-0-006f-72b7 State : Ready (RDY) Size (in MB)/(in sectors) : 953869/1953525167 Manufacturer : ATA Model Number : APPLE HDD WD10EZ Firmware Revision : 3D03 Serial No : WDWCC1S5966663 GUID : N/A Protocol : SATA Drive Type : SATA_HDD ------------------------------------------------------------------------ Enclosure information ------------------------------------------------------------------------ Enclosure# : 1 Logical ID : 590b11c0:3dc9eb00 Numslots : 8 StartSlot : 0 Enclosure# : 2 Logical ID : 50030480:006f72bf Numslots : 13 StartSlot : 0 ------------------------------------------------------------------------ SAS2IRCU: Command DISPLAY Completed Successfully. SAS2IRCU: Utility Completed Successfully. [root@m5_nas ~/.sas2ircu]#