Spinning Down your Drives and Checking Power States. (New Script)

Motorhead

Dabbler
Joined
Dec 18, 2015
Messages
16
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
  • 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'
Example:
[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

  • DriveStatus.zip
    753 bytes · Views: 374
Last edited:

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
While this is useful script, I just want to point out that there are many that believe (including myself) that spinning down drives does little to save energy and can put extra strain on the drives when spinning up/down all the time.
 

Motorhead

Dabbler
Joined
Dec 18, 2015
Messages
16
While this is useful script, I just want to point out that there are many that believe (including myself) that spinning down drives does little to save energy and can put extra strain on the drives when spinning up/down all the time.

Thanks for pointing that out. I completely agree with your scenario, but its misleading and does not apply to everyone.

I'm not trying to track away from what this thread is intended for. With that being said, it really depends on the use case of each implementation. The power savings will add up if you're running multiple drives. I'm not sure what the real world benchmarks are on my Seagate 4TB drives. However the spec sheet states they use 4w idle and .5w in standby. With 8 drives, that's 32w vs 4w. I believe those savings are completely justified.

Again though, it depends on how often the drives are accessed and how the scrubs/smart tests are set up. If the NAS is constantly accessed throughout the day, with a 15minute idle to spindown, well that's not a good idea. On the flip side, if you're someone who uses it sparingly, throughout the month? Set the spindown time out to a few hours to save some juice and it wont over strain the drives. Thinking otherwise would not be logical in that scenario, in my opinion. We can come up with many scenarios that justify when and how to use the feature and when not to use it. It just depends.
 
Last edited:

qubus

Cadet
Joined
Oct 20, 2013
Messages
8
Hi there

I just tested a couple of new WD harddrives and got a strange result. Instead of the usual "00" or "FF", I'm getting an "81" back. Anyone know what that means? I assume it's some kind of power saving state as the drives have not been accessed in a while. Here is what I'm getting:

Command: camcontrol cmd ada2 -a "E5 00 00 00 00 00 00 00 00 00 00 00" -r -
Output: 50 00 00 00 00 00 00 00 00 81 00

I could not find any documentation on the output at all.
 
Top