Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #203801

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

From Reco <recoverym4n@enotuniq.net>
Newsgroups linux.debian.user
Subject Re: hdparm ignoring spindown_time in config when called with by-id symlink
Date 2019-01-02 14:40 +0100
Message-ID <xbOUx-7gI-3@gated-at.bofh.it> (permalink)
References <xby3n-57E-5@gated-at.bofh.it> <xbMJ3-5YM-13@gated-at.bofh.it> <xbNYu-6Fn-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


	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

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

hdparm ignoring spindown_time in config when called with by-id  symlink Andrea Borgia <andrea@borgia.bo.it> - 2019-01-01 20:40 +0100
  Re: hdparm ignoring spindown_time in config when called with by-id  symlink Reco <recoverym4n@enotuniq.net> - 2019-01-02 12:20 +0100
    Re: hdparm ignoring spindown_time in config when called with by-id  symlink Andrea Borgia <andrea@borgia.bo.it> - 2019-01-02 13:40 +0100
      Re: hdparm ignoring spindown_time in config when called with by-id  symlink Reco <recoverym4n@enotuniq.net> - 2019-01-02 14:40 +0100
        Re: hdparm ignoring spindown_time in config when called with by-id  symlink Andrea Borgia <andrea@borgia.bo.it> - 2019-01-02 16:00 +0100

csiph-web