I bought a new HD(WD5000BPVT) which unfortunately tries to sleep every 5-8 seconds. Not only is the clicking noise quite audible, the 1-second spinup time adds very noticeable latency in day-to-day use.

I've found hdparm -B 254 /dev/sda will disable the very short sleep but I don't know how to enforce this setting every time the drive is powered on. The dconf-editor and 'Power Management Preferences' apps both do nothing with regard to HD settings. I don't have any /etc/hdparm or /etc/acpi paths. MATE is the window manager.

On Fedora 19, how can I force this command to run whenever the drive is activated?

5 Answers 5


I had the same problem none of the solutions here suited my needs. Using cron is really a workaround, not a solution, udev rules are run when power is connected/disconnected but not after suspending/resuming and pm-utils are no longer used by default in Fedora 19 when you for example close lid of your laptop.

Since systemd is now responsible for suspending/hibernating, I think that the only proper way to handle this situation is to create a systemd unit that will run both after boot and after resuming from suspend.


  • By using /dev/disk/by-id/... instead of /dev/sda, you are always be sure to get the right disk (sda,b,c depends on the order they are detected by the kernel)
  • You can have multiple ExecStart lines so you can configure multiple disks

Here's the unit I wrote:

Description=Silence HD

# Disable automatic head parking for the main disk
ExecStart=/sbin/hdparm -B 254 /dev/disk/by-id/ata-ST3250824AS_4N127FD1
# Enable automatic spin down after 30 seconds for the second, infrequently used disk
ExecStart=/sbin/hdparm -S 6 /dev/disk/by-id/ata-ST31000528AS_BVP5H5X1

WantedBy=suspend.target basic.target

Save this file as /etc/systemd/system/hdsilence.service and then enable it using:

systemctl enable hdsilence.service
systemctl daemon-reload
  • Works great here on Fedora 20, too. Thank you!
    – Jakob
    Commented Oct 11, 2014 at 10:28
  • So this makes changes to /etc/hdparm.conf obsolete?
    – domih
    Commented Nov 18, 2018 at 21:23
  • @domih: As far as I can tell the hdparm.conf is a Debian thing and it is not supported on Fedora. Commented Nov 22, 2018 at 11:26

You can have the system run the command during boot by creating your own systemd service or adding the command to /etc/rc.d/rc.local.

If you want the command to run every time you wake the system after sleep/hibernate, you can add a script that starts with 2 digits to /etc/pm/sleep.d/, look at the other scripts in /usr/lib64/pm-utils/sleep.d (assuming x86_64) for more details. Basically, it takes a parameter depending on which state it is entering. You might also need to add some login to power.d/ in the same parent directory if you want to operate differently on battery power compared to when plugged in.

  • 1
    creating your own systemd service can you be more specific? I don't have a /etc/rc.d/rc.local file.
    – Pete
    Commented Jun 23, 2013 at 18:18
  • 1
    The systemd documentation explains the syntax of a systemd service unit. The /etc/rc.d/rc.local file is just a shell script, create it and make sure its executable.
    – jsbillings
    Commented Jun 25, 2013 at 0:48

For different settings when running on AC / battery, I'd do it via a simple udev rule, e.g.

SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/usr/bin/hdparm -B 128 /dev/sda"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/usr/bin/hdparm -B 254 /dev/sda"

This would set apm to 254 when the laptop is plugged in and respectively 128 when unplugged. Also, it should always work, even after resuming from suspend.

  • 1
    For those who like copying verbatim, newer releases have hdparm in /usr/sbin, so adjust the paths.
    – Roman
    Commented Aug 5, 2013 at 18:49

I have the same disk (and the same problem). My stupid but working solution: I have put that in /etc/crontab:

-*/5  * * * *   root  hdparm -B 254 /dev/sda
  • Doesn't this simply access the drive every 12 seconds? I considered something along that line but I kinda would like some level of sleep when undocked.
    – Pete
    Commented Jun 23, 2013 at 16:59
  • Every five minutes. You may write a wrapper script which checks the power state of the system. Commented Jun 23, 2013 at 17:04

The udev rules work well on plug events, but to get the correct behaviour after resume from suspend I need somthing like this in /etc/pm/sleep.d:


case "${1}" in
    if grep -q 1 /sys/class/power_supply/ADP1/online; then
      /usr/sbin/hdparm -B 254 /dev/sda
      /usr/sbin/hdparm -B 128 /dev/sda

You must log in to answer this question.

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