OS: GNU/Linux Debian 9.2

I want to change my computers behavior to suspend HDDs when idle for 30 minutes.

So far I have found out I need to change APM level to allow suspending disks by setting:

hdparm -B 127 /dev/sdX

Where 127 is actually the maximum value allowing suspending drives (spindown).

Then I went to the standby setting:

hdparm -S 241 /dev/sdX

Where 241 means it should standby after 30 minutes.

No error reported by hdparm while setting these.

Now my question:

Do these settings vanish after each reboot? If so, where should I put those commands in order for it to be persistent?

Just to note that I want to affect the following devices at once:


Warning: This question was intended for experimenting purposes only. By increasing the Start/Stop count cycles in your HDD's S.M.A.R.T. your HDD could deteriorate faster than if kept running.


1 Answer 1


Do these settings vanish after each reboot?

In case of a soft reboot, where the drive stays powered up, the settings don't vanish. Power cycle does reset the APM parameter. (At least, on my laptop)

Most setters are also getter options in hdparm. The APM setting can be easily checked by:

# hdparm -B /dev/sdb

APM_level      = 128

This doesn't work for the stand-by timer option, though. But logically, those settings are lost also.

Where should I put those commands in order for it to be persistent?

All kind of options, custom udev rule, systemd service, cron job (@reboot). What suits you the best.

Arch wiki is quite a nice resource for more info.

Inspired by the above wiki, I created a systemd service file for my Gentoo system:

Description=hdparm sleep

ExecStart=/sbin/hdparm -S 12 -B 127 /dev/sdb

WantedBy=multi-user.target suspend.target

You may want to affect all of your devices with your settings at once as follows:

ExecStart=/sbin/hdparm -B 127 -S 241 /dev/sda /dev/sdb /dev/sdd /dev/sde

Note that you have to use absolute paths for everything, you can't do e.g. cmd /dev/sd[abde]. The exact location to the hdparm binary can be different in your distribution.

Use the following command to know location of your hdparm which would normally be called:

which hdparm

Then, you may enable the service and optionally start it, you may simply want to reboot the machine to be 100% sure it works.

# systemctl enable hdparm.service
# systemctl start hdparm.service
# systemctl status hdparm.service

Arch's proposal suppresses output, but I prefer to verify the success of hdparm with the last issued command.


I found that after suspend, the parameters where not hold by my hard drive. This might be the case for more laptop systems. Therefore I've modified the example unit file. Courtesy to this answer on unix.SO.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .