Web lists-archives.com

hdparm ignoring spindown_time in config when called with by-id symlink


My PC has two disks, a NVME for Debian/testing and an old 2.5 drive for an OS that shall remain nameless :)

Since the 2.5 disc isn't at all used by Linux, I figured I might as well set a very aggressive spindown time of, say, 30s and I wrote this in hdparm.conf:

/dev/disk/by-id/ata-Hitachi_HTS543225A7A384____E2024242DBNGWJ_ {
    apm = 1
    spindown_time = 6

To check whether the entry was applied, first I manually set the spindown to 1 unit, that is 5s, woke the drive up with cfdisk, confirmed it was active with hdparm -C, waited 5s, confirmed it was in standby.
So if the drive sleeps just 5s I'll know the change was ignored.

Then I tried checking whether hdparm would work when run via udev, with the following command: DEVNAME=/dev/disk/by-id/ata-Hitachi_HTS543225A7A384____E2024242DBNGWJ_ /lib/udev/hdparm >> /tmp/hdparm.log 2>&1 (suggestion taken from: https://stackoverflow.com/questions/49841690/hdparm-conf-settings-dont-seem-to-run-at-boot)

No go:
 setting Advanced Power Management level to 0xfe (254)
 APM_level	= 254
More importantly, the drive is still on 5s spindown.
I've tried with the apm option and without, no changes.
I've manually verified the by-id link, checks out.

However, if I invoke the udev script with /dev/sdb, the output confirms it is working:
 setting Advanced Power Management level to 0x01 (1)
 setting standby to 6 (30 seconds)
 APM_level	= 1

Now, the questions:
1) am I wrong in using the by-id link to achieve a stable configuration?
2) am I wrong in testing with the symlink instead of the real device name?
3) if not, should I file a bug on hdparm?

Other relevant bugs:
#725884: in my case, running hdparm manually works just fine, it's the udev script that seems to fail somehow #795025: my drive does not return any error when hdparm is run with "verbose"
#880008: interesting...