Re: hdparm ignoring spindown_time in config when called with by-id symlink
Hi.
On Wed, Jan 02, 2019 at 01:34:14PM +0100, Andrea Borgia wrote:
> Il 02/01/19 12:15, Reco ha scritto:
>
> > What about this:
> > DEVNAME=/dev/disk/by-id/ata-Hitachi_HTS543225A7A384____E2024242DBNGWJ_ \
> > sh -x /lib/udev/hdparm >> /tmp/hdparm.log 2>&1
>
> I had tried it, too, and it looks in line with the results:
Good news are - your configuration file comes into play:
> + OPTIONS= -B1 -S6
Bad news are - /lib/hdparm/hdparm-functions screws you over:
> + read KEY SEP VALUE
> + [ -z /dev/sdb ]
> + [ -n -B1 -S6 ]
> + [ /dev/sdb = /dev/disk/by-id/ata-Hitachi_HTS543225A7A384____E2024242DBNGWJ_ ]
This corresponds to line 222 of aforementioned script:
if [ -n "$OPTIONS" ] && [ "$DISC" = "$WANTED_DISK" ]
then
echo $OPTIONS
return 0
fi
You have options defined, but second comparison fails. $DISC seems to be
defined at line 113:
DISC=$(readlink -m "$KEY")
DISC=${DISC%%[[:digit:]]*}
And readlink 'helpfully' transforms your 'persistent' HDD name to
/dev/sdb.
So udev is not to blame here. It's shell-based config parsing library.
> (copypasted because I found out only later that Thunderbird could not attach files from /tmp because of AppArmor)
Whitelist it. A file should be called
/etc/apparmor.d/local/usr.bin.thunderbird.
> > > 2) am I wrong in testing with the symlink instead of the real device name?
> > I'd rather remove this HDD via /sys interface as it's unused.
>
> Apart from the fact I don't know (yet) how to do that, what good would it do?
echo 1 > /sys/block/sdb/device/delete
Assuming that your SATA controller is sane, it'll powerdown the drive
until the next reboot or SATA bus scan.
Reco
Reply to: