Linux: Switch a idle hard disk into standby mode

Hi,

I have running a debian based multimedia server. The operating systems is installed on a compact flash card (/dev/sda), the data resides on a external USB SATA harddisk (/dev/sdb).
The (Server 🙂 ) Hardware is a Fujitsu Futro A240 ThinClient, with a power consumption of only 7W. I’m using the server for about 2 hours each day, therefore I looked for a method to save power and switch the USB disk to standby mode when its idle for while.

Check first if your hard disk supports the standby mode.  Ensure that the disk is idle, otherwise the disk is immediately active again.

Switch to Standby mode

root@debdev:~# hdparm -y /dev/sdb

/dev/sdb:
    issuing standby command

and check it.

root@debdev:~# hdparm -C /dev/sdb

/dev/sdb:
    drive state is:  standby

This can be done automatically if the disk is idle for a specific time. Use hdparm -S xx /dev/sdxx
The parameter -S is the timeout value. The following table (from man hdparm manpage) describes the possible values:

Parameter -S Description Time
1 to 240 specify multiples of 5 5 to 1200 seconds(20min)
241 to 251 1 to 11 units of 30 minutes 30 minutes to 5.5 hours
252 signifies a timeout of 21 minutes 21 minutes
253 sets a vendor-defined timeout period between 8 and 12 hours. Vendor specific
254 reserved reserved
255 is interpreted as 21 minutes plus 15 seconds. Note: some older drives may have very different interpretations of these values 21,25 minutes

The following command line sets the timeout to 15 minutes


root@debdev:~# hdparm -S 180 /dev/sdb
/dev/sdb:
  setting standby to 180 (900 seconds)

You have to set the timeout each the the operating system starts. This can be done by editing the /etc/hdparm.conf file. Find an already defined and uncommented section for your disk or add a new one:


/dev/sdb {

     spindown_time = 180

}

Nice powersaving:-)

Michael

2 thoughts on “Linux: Switch a idle hard disk into standby mode”

  1. hello Michael! I am using Linux os in Hp laptop. My hard disk is not working properly. I have also taken various method to avoid this problem but It couldn’t work. I think this method works for Switch hard disk into standby mode. Thank you!

  2. If you are a Lenovo user and you are facing an issue with your Hard disk and your data could not save in hard disk or any other error go to the Lenovo Support and follow
    it helps to solve out my hard disk drives problems. Thankyou

Leave a Reply to John Carter Cancel reply