LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   USB disk won't sleep under Slackware-14.0 (https://www.linuxquestions.org/questions/slackware-14/usb-disk-wont-sleep-under-slackware-14-0-a-4175434482/)

ljb643 10-28-2012 09:23 AM

USB disk won't sleep under Slackware-14.0
 
After upgrading to Slackware-14.0, my external USB disk no longer goes to sleep when idle. This is a disk with no mounted volumes 99% of the time, so it used to sleep nearly all the time.

Under Slackware-13.37, after about 15 minutes the disk would spin down and go to sleep, until I tried to mount a volume on it. This sleep function has nothing to do with PC power management - it isn't controlled by any daemon on the PC - it is built-in to the Seagate drive.

With Slackware-14.0, it will never sleep as long as I am logged in. (I'm using the Xfce desktop.) As a test, I booted up and did not log in. After 15 minutes the disk went to sleep. Then I logged in, and the disk immediately woke and spun up. Again: nothing is mounted.

Has anyone seen this, or know what is causing it? I first suspected udisks2 is the cause, but that runs even when nobody is logged in, doesn't it? Is something new in Slackware-14 sending periodic polls to the disk, keeping it awake? Any thoughts on how to trouble-shoot this?

Cesare 10-29-2012 05:13 AM

I had a similar problem. After idling for 5 minutes my USB-disk would spin down, only to spin up again a minute later without me touching anything - or not spinning up at all, even when trying to mount it. This is what I did then...

1) Disconnected the disk from the on-board Etron USB3 port and plugged it into a NEC PCIe-card which I had from 13.37 days when the Etron chip didn't work at all. Didn't investigate this any further.

2) Uninstalled udisks2.

Udisks2 is a funky piece of software. I seems to constantly poll each HDD, e.g. for SMART information (I didn't ask for that?!) and I couldn't figure out a way to disable it or at least stop it from touching certain HDDs (a udev-rule with ENV{UDISKS_IGNORE}="1" didn't work).

At the end of the night I decided it wasn't worth it and just uninstalled udisks2. Thanks to no depedencies this is possible without dragging XFCE along. Everything has been working fine since. The USB-disk spins down after 5 minutes of inactivity (I keep it mounted ro) and reliably comes back to life when mounting rw or accessing it.

Sorry if this post doesn't provide any real insight. If somebody can explain the way udisks2 works (or doesn't), I'd be interested.

ljb643 10-29-2012 08:20 AM

Thanks for the idea. I thought about udisks2 being behind this, but doesn't udisks2 run from boot-time, not only while logged in? So I couldn't see why the disk would go to sleep when not logged in, but wake up and stay awake while I was logged in, if the cause was udisks2. But it is still on my list of possible causes, along with gvfs.

ljb643 10-29-2012 10:25 AM

Well, that's interesting. Every 10 minutes UDisks2 is updating its SMART information about each system disk. (That's from "udisksctl monitor".) This doesn't tell me UDisks2 is polling the disk, or explain about the difference between logged in and not, but... it does fit. If the disk would sleep after 15 minutes, but it polls at 10 minutes, it would never sleep. "More research is needed."

(How ironic if SMART - which is meant to predict failure, and make disks more reliable - is being used to shorten the disk life by keeping it from sleeping when idle.)

ljb643 10-31-2012 03:02 PM

It was exactly as Cesare said (thanks!). Udisk2 is polling the drive every 10 minutes for a SMART update, and this is keeping the drive awake. I found some comments about this on the freedesktop bugzilla:

Quote:

But even with SMART enabled, udisks reading SMART data should not wake up the disk - in fact, we check if the disk is asleep and avoid reading SMART data if this is so.... if this in turn causes the disk to never go to sleep, I think it may be a problem with the disk sleep timer in question (changing the disk sleep timeout to < 10 min or forcing it to go to sleep could fix it).
So that's what is happening. With an internal sleep timer of 15 minutes, the 10 minute probes keep it awake. If the sleep timer was shorter than 10 minutes, the disk would sleep, and presumably udisks would stop probing it.

I don't know how to change the sleep time in the disk - if it is possible at all - but I did find out how to disable SMART reporting. (I first tried smartctl -s off, which turns it off, but udisks apparently turns it back on.) Here is a udev rule I added to /etc/udev/rules.d/95-local.rules.

Code:

ATTRS{idVendor}=="0bc2", ATTRS{idProduct}=="3300", ENV{UDISKS_IGNORE}="1", ENV{ID_ATA_FEATURE_SET_SMART_ENABLED}="0"
Note this uses my drive Vendor and Product codes; others will differ. Also this sets UDISK_IGNORE to keep the drive from displaying on the Xfce desktop, which is a separate problem fixed by this rule.

With the above rule, the external disk now goes to sleep as it should.


All times are GMT -5. The time now is 09:03 AM.