How to Verify and Troubleshoot HDD Spindown Time Settings Using hdparm


7 views

When configuring hard drive spindown timings via hdparm, many sysadmins encounter a frustrating limitation: while APM (Advanced Power Management) values are easily visible in drive info outputs, the actual spindown timeout setting remains opaque. This creates debugging challenges when drives don't behave as expected.

While the command hdparm -I /dev/sda | grep Advanced shows APM levels, there's no direct way to query the current spindown timer setting. However, we can indirectly verify it:


# Check if APM is enabled (value > 0)
sudo hdparm -B /dev/sda

# Check standby timer (returns current value in 5-second units)
sudo hdparm -C /dev/sda

# Alternative method using smartctl (may vary by drive model)
sudo smartctl -i /dev/sda | grep -i "APM level"

Several factors can override your hdparm settings:

  • Aggressive power management daemons (like tuned or laptop-mode-tools)
  • Filesystem activity (ext4 journals, NTFS metadata)
  • Background processes (updatedb, crash dumps)
  • Hardware differences (some enterprise drives ignore -S setting)

When spindown isn't working as expected:


# 1. Verify no system services are interfering
sudo systemctl stop tuned
sudo systemctl mask laptop-mode.tools

# 2. Check for disk activity
sudo iotop -oPa

# 3. Test with raw commands (example for 30-minute timeout)
sudo hdparm -B 127 -S 241 /dev/sda  # 241 = 30*60/5/1.5
sudo hdparm -y /dev/sda  # Force immediate spindown

# 4. Monitor actual spindown behavior
sudo hdparm -C /dev/sda
watch -n 1 'cat /proc/diskstats | grep sda'

For a Dell XPS with 1TB HDD, this configuration reliably achieved 15-minute spindown:


# /etc/rc.local addition:
/sbin/hdparm -B 192 -S 180 /dev/sda
/usr/bin/sdparm --set STANDBY=1 /dev/sda

# Then verify with:
sudo smartctl -i /dev/sda | grep -A5 "Power Management"

For persistent configuration across reboots:


# /etc/udev/rules.d/99-hdd-spindown.rules
ACTION=="add", KERNEL=="sda", RUN+="/sbin/hdparm -B 127 -S 241 /dev/$kernel"

# Reload rules
sudo udevadm control --reload
sudo udevadm trigger /dev/sda

When working with HDD power management in Linux, setting the spindown timer via hdparm -S is straightforward, but verifying the actual configured value isn't as obvious as checking APM settings. Here's what you need to know:

The standard approach would be:

sudo hdparm -I /dev/sda | grep -i "advanced power management"

But this only shows APM settings, not the spindown timer. The -S parameter (spindown time) isn't displayed in the info output, which creates confusion about whether the setting was actually applied.

Here are three practical ways to verify spindown behavior:

1. Direct Observation Method

After setting the timer, run:

sudo hdparm -C /dev/sda

Then wait for the configured time period and check again. If the state changes from "active/idle" to "standby", your setting works.

2. Using smartctl for Indirect Verification

sudo smartctl -i /dev/sda | grep -i "power mode"

Monitor this output over time to see power state changes.

3. System Log Inspection

Check kernel messages for disk activity:

dmesg | grep -i sda

Or system logs:

journalctl -f | grep -i "disk spindown"

As mentioned in the update, Linux's tuned service can override manual hdparm settings. To check if tuned is active:

systemctl status tuned

To temporarily disable its influence:

sudo systemctl stop tuned
sudo systemctl disable tuned

To make sure your settings persist across reboots, create a udev rule:

# /etc/udev/rules.d/99-hdd-spindown.rules
ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd[a-z]", RUN+="/usr/bin/hdparm -S 246 -B 128 /dev/%k"

Then reload udev rules:

sudo udevadm control --reload-rules
sudo udevadm trigger

When troubleshooting spindown issues:

  1. Verify no processes are keeping the disk active (lsof /dev/sda)
  2. Check for filesystem journaling activity
  3. Test with different timeout values (try very short intervals first)
  4. Consider disk health (failing disks may ignore power commands)

Remember that some enterprise-grade disks may ignore APM/spindown settings entirely as part of their firmware design.