Does the Raspberry Pi 2 put USB external drives to sleep when not in use for a while?
Solution 1:
On the Raspberry (I am assuming you use Rasbian), hdparm must be installed,
sudo apt-get install hdparm
and then you must reboot the RPI in order to allow hdparm to interface itself correctly with udev
.
sudo hdparm -I /dev/sda
will print all of the known characteristics of the device. It is long, and unwieldy, but very thorough.
You are searching for the properties related to Power Management. The ever helpful Arch Linux Wiki says:
-B
Set the Advanced Power Management feature. Possible values are between 1 and 255, low values mean more aggressive power management and higher values mean better performance. Values from 1 to 127 permit spin-down, whereas values from 128 to 254 do not. A value of 255 completely disables the feature.
-S
Set the standby (spindown) timeout for the drive. The timeout specifies how long to wait in idle (with no disk activity) before turning off the motor to save power. The value of 0 disables spindown, the values from 1 to 240 specify multiples of 5 seconds and values from 241 to 251 specify multiples of 30 minutes.
You query the current value of (for instance) B as:
sudo hdparm -B /dev/sda
and you set it as
sudo hdparm -B 255 /dev/sda
and likewise for -S
.
Once again the ever-helpful states:
Warning: Too aggressive power management can reduce the lifespan of your hard drive due to frequent parking and spindowns.
This should allow you to configure power management to your liking.