Does the Raspberry Pi 2 put USB external drives to sleep when not in use for a while

external hard driveraspberry piraspbiansleep

I recently got a LaCie 2TB Thunderbolt bus-powered USB external rugged drive. I am using it with the Raspberry Pi 2 and it works fine. It's being used as a remote backup via rsync.

However, I am use to not leaving a rugged drive powered up all the time. I see no way to power down the LaCie drive when it's not needed for extended periods of time. My experience with self-powered LaCie rugged drives (larger in physical size) is that they run hot to the touch if left on all day even if there is no activity to the drive.

Does the Raspberry Pi 2 put external USB hard disks to sleep after a certain period of inactivity? If so, can this timer(?) be controlled? What is the default?

Best Answer

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.