spindown HDDs, hdparm.conf settings are not applied when Proxmox reboot

ste-bm

New Member
Aug 17, 2023
4
0
1
I've installed a new homelab server with Proxmox 8.0.4 that has a few SSDs and 4 HDDs(zfs raidz). As the HDDs are primarily used for backups and data that's sporadically accessed I want the HDDs to spindown after 10mins of idle. The settings I'm using in hdparm.conf are not applied when I restart Proxmox.

From command line I tested the following commands with hdparms and they work well:
hdparm -S 120 /dev/sda
hdparm -S 120 /dev/sdb
hdparm -S 120 /dev/sdc
hdparm -S 120 /dev/sdd

The disks spindown after 10mins as I want.

Then in order to have the above settings set at startup in case Proxmox is restarted, I've added the following configuration to /etc/hdparm.conf:
/dev/disk/by-id/ata-WDC_WD40EFPX-68C6CN0_WD-WX22D6387HLY {
spindown_time = 120
}

/dev/disk/by-id/ata-WDC_WD40EFPX-68C6CN0_WD-WX42D63J6YE9 {
spindown_time = 120
}

/dev/disk/by-id/ata-WDC_WD40EFPX-68C6CN0_WD-WXC2D532N5ES {
spindown_time = 120
}

/dev/disk/by-id/ata-WDC_WD40EFPX-68C6CN0_WD-WX42D636RZRA {
spindown_time = 120
}
Although it doesn't work and every time I restart it I need to manually configure the spindown time. I've tried also a different sintax with /dev/sda {}, that doesn't work either.

Any suggestion on how I can get the hdparm.conf settings applied at startup? Thanks

I posted this same question a few days ago with no luck so far on Stackoverflow.
 
The /etc/hdparm.conf file looks good to me.
Does triggering the udev rule manually work?
Code:
udevadm trigger /dev/sda
 
The /etc/hdparm.conf file looks good to me.
Does triggering the udev rule manually work?
Code:
udevadm trigger /dev/sda

Thanks for confirming my configuration looks to be correct.

I’m not familiar with udevadm, what should I expect to see if I run that command?
 
If the udev rule found in /usr/lib/udev/rules.d/85-hdparm.rules is configured properly,
Code:
ACTION=="add|change", SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]", RUN+="/lib/udev/hdparm"
then /lib/udev/hdparm should be called upon triggering that udev rule.
The udev events can be monitored with udevadm monitor -u to check whether a udev rule was triggered.

Triggering the udev rule should run the script located at /lib/udev/hdparm. So you can also check whether that script gets called.
 
I checked the udev rules and it matches your example.
I then monitored the output of the trigger command and I get the following:

UDEV [777876.695578] change /devices/pci0000:00/0000:00:17.0/ata5/host4/target4:0:0/4:0:0:0/block/sda (block)
UDEV [777879.804784] change /devices/pci0000:00/0000:00:17.0/ata5/host4/target4:0:0/4:0:0:0/block/sda/sda9 (block)
UDEV [777879.838779] change /devices/pci0000:00/0000:00:17.0/ata5/host4/target4:0:0/4:0:0:0/block/sda/sda1 (block)
I’m not sure what to read from the above other than it lists some ref to sda, sda1 and sda9.

Any suggestion what I should try to do next?
Thanks
 
Last edited: