While setting up and testing my drive standby parameters. I wanted an easy way to check the power states of all connected ADA devices on FreeNAS 9.3. I wrote this up and wanted to share it in case anyone else finds this to be helpful.
I used this article initially for checking the drive power state. However, you don't need to create those init scripts to get your drives to spin down. Just use the standby parameters in the "View Disks" section of the GUI. Also make sure to set your SMART tests accordingly under "services." Lastly, like the article states, make sure to move your system dataset to another drive. I moved my jails and system dataset to a spare 80gb 2.5" drive. However I believe a 32Gb drive would suffice.
DriveStatus.sh
[root@FreeNAS] /mnt/System_0/SystemUtils/DriveStatus# ./DriveStatus.sh
ada0: 00
ada0: Standby
ada1: FF
ada1: Running
CODE:
I used this article initially for checking the drive power state. However, you don't need to create those init scripts to get your drives to spin down. Just use the standby parameters in the "View Disks" section of the GUI. Also make sure to set your SMART tests accordingly under "services." Lastly, like the article states, make sure to move your system dataset to another drive. I moved my jails and system dataset to a spare 80gb 2.5" drive. However I believe a 32Gb drive would suffice.
DriveStatus.sh
- I've attached the script to this thread
- I like setting up shortcuts, so an clean method to implement:
- Drop an alias line in the ~/.cshrc
- alias DriveStatus '/mnt/System_0/SystemUtils/DriveStatus/DriveStatus.sh'
[root@FreeNAS] /mnt/System_0/SystemUtils/DriveStatus# ./DriveStatus.sh
ada0: 00
ada0: Standby
ada1: FF
ada1: Running
CODE:
Code:
#!/bin/bash # # Created by: Motorahead # Date: 02/19/2016 # Checks For Running Status of Connected ADA Devices # Look for Connected Devices DEVICELIST=($( camcontrol devlist | grep -o 'ada[0-9]' )) # Checks Drive Status, but only outputs relative field $10 STATUS(){ camcontrol cmd ${LIST} -a "E5 00 00 00 00 00 00 00 00 00 00 00" -r - | awk '{print $10}' } # Loop through each device found in ${DEVICELIST} for LIST in ${DEVICELIST[@]}; do echo -n "${LIST}: " STATUS # If the Output is 00, then the drive is in Standby. If it's FF, then it's active. if [[ "$(STATUS)" == "FF" ]]; then echo "${LIST}: Running" elif [[ "$(STATUS)" -eq "00" ]]; then echo "${LIST}: Standby" else echo "${LIST} is in a unrecognized state." fi done
Attachments
Last edited: