Quick-Tip: disable standby for USB devices on Linux

Tuesday, February 3, 2015 10:43 PM UTC

I just noticed that my new Media PC running on a Raspberry Pi B+ lost the external USB hard disk for some reason. This is strange because it's mounted via fstab at boot time and should "awake" from standby when accessing it. Sometimes it's a hassle with external HDD esp. when they come complete in a housing and are not self made. The built-in controllers are cheap so you better deactivate this feature permanently. In my case I don't turn off my Pi. The following command must be run as root or with sudo.

The solution is to use hdparm:

hdparm -C /dev/sda1

checks the current mode of the device (active/idle or standby)


hdparm -S xx /dev/sda1

you can set the time after which the device will get into standby. If you set this value to 0 standby mode is deactivated.

In addition I use a simple cron job to touch a file on that device every 10 minutes via the crontab:

crontab -e

and adding a new job line:

*/10 * * * * touch /media/3TB/.wakeup

Replace the path with your path to where the device is mounted to.

With the Raspberry and the installed raspbian OS I noticed that no cronjob was executed because the task isn't activated at boot time. I like to setup those startup scripts with the handy tool called sysv-rc-conf which you can install with

apt-get install sysv-rc-conf

Once installed run it with


and you can set the cron service activated at runlevel 1 simply by ticking it on ("X"). Leave sysv-rc-conf with "q" after that.

Latest comments to this post

Leave a comment right here