External USB HDD is not spinning down

Smart tools are not installed by default on OSMC so you must have installed them at some point - so this issue wouldn’t affect most users.

@DBMandrake: I beg to differ with your statement, as I had just verified the file’s existence in a fresh osmc installation. udisks-helper-ata-smart-collect is part of udisks, which comes pre-installed, with libatasmart a part of the package: https://packages.debian.org/sid/admin/udisks.

It’s udisks itself that is responsible for doing smart polling every x minutes or so (or at least does that on WD Mybook drives, as I rememember not having the same issue with a Seagate Passport - which on the other hand needed hd-idle to actually sleep, hdparm alone wasn’t doing anything).

Nevertheless, this seems to be a known issue, and according to this (https://bugs.launchpad.net/ubuntu/+source/udisks/+bug/638765 and this (https://bugs.freedesktop.org/show_bug.cgi?id=26508#c0), the following would be a permanent workaround:

Create a file /etc/udev/rules.d/80-udisks.rules with the following contents:

KERNEL==“sd*[!0-9]”, ATTR{removable}==“0”, ENV{ID_BUS}==“usb”, ENV{DEVTYPE}==“disk”, ENV{UDISKS_DISABLE_POLLING}=“1”
KERNEL==“sd*[!0-9]”, ATTR{removable}==“0”, ENV{ID_BUS}==“ata”, ENV{DEVTYPE}==“disk”, ENV{UDISKS_DISABLE_POLLING}=“1”
KERNEL==“sd*[!0-9]”, ATTR{removable}==“0”, ENV{ID_BUS}==“scsi”, ENV{DEVTYPE}==“disk”, ENV{ID_VENDOR}==“ATA”, ENV{UDISKS_DISABLE_POLLING}=“1”

2 Likes

I can confirm that cocomi’s solution works as well.
I hope it will be in the next osmc update.

Hi,
Im also having this issue with my external HDD being woken up on a regular basis after spinning down, this seems like it will also help me out BUT im afraid Im useless with Linux, would someone be able to give me a step by step guide how to apply this fix?
I have putty set up and I am able to SSH to my raspberry pi, so I think I need to use Nano to create this new file?

Much appreciated,

Navi

Hi,
I’m also using an HDD on rpi.
I configured the fstab to have
/ on sd card
/home on HDD
but /home/osmc on sd card

my media file are on /home/media, so on HDD (it’s just a file not linked to an user. )
I used to have my hdd spinning down after some time without request.
But one day, my HDD start to run continuously…
command hdparm -y /dev/sda stops the HDD spinning
thanks to command > sudo iotop -o -t, I seen that a frequent CEC operation was waking up the drive, and then prevent it from spinning down.

So, I took the siple way and disabled the CEC adapter, wich I was not using, and it is now working as previously.
Why? is it normal? I realy do not know :slight_smile:
I hope it may help some people having the same issue,

Bst regards,
Axel

@cocomic I’ve been using your udev rule for a few years now, which has been working excellently. However, in the last few months (?) my HDD hasn’t been spinning down again. Has anyone else experienced this? Has something changed in OSMC?

We will automatically spin down drives after 15 minutes of inactivity. If it stays spinning, some files may remain in use on it.

Oops, looks like I just needed a restart.

However, @sam_nazarko I can confirm that without @cocomic’s udev rule, my USB HDD definitely never spins down. With the rule installed, it spins down as expected. I tested with and without the rule installed, twice each. I also checked with lsof, and can confirm that (without the udev rule and hence not spinning down) there were still no files open on the HDD.