You are not logged in.

#1 2023-04-07 18:54:22

aardwolf
Member
From: Belgium
Registered: 2005-07-23
Posts: 310

Inserting USB stick wakes up hard disk

Hi,

I have a hard disk that I only use for backups and preferably it should sleep in standby mode.

Whenever I plugin a USB stick, this hard disk gets woken up and starts spinning up. Actually, when removing a USB stick too.

I'd like this disk to spin up only if I explicitly myself query its contents, or explicitly start copying files to its path.

Is there a way to prevent this useless spinning up when inserting USB stick? There are other unwanted things that spin it up too, such as opening the dolphin file manager even when not viewing this disk (nemo behaves better here). But the USB stick case is the most annoying now since for that one I don't have an alternative...

Thanks!

Last edited by aardwolf (2023-04-07 18:55:22)

Offline

#2 2023-04-07 19:22:48

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,681

Re: Inserting USB stick wakes up hard disk

Does this also happen in the multi-user or resuce target (no overzealous DE)?
Is the HDD usb as well? Same hub?

Offline

#3 2023-04-07 19:52:09

aardwolf
Member
From: Belgium
Registered: 2005-07-23
Posts: 310

Re: Inserting USB stick wakes up hard disk

I'm not sure what overzealous DE means, or multi-user in this context. Since I don't know what it is, it can probably be assumed it's the default for a single-user desktop PC.

I should have given more info on the HDD: it's /dev/sda, connected using SATA. This is the only HDD in this machine, and the only device connected with SATA. The main disks are two SSD's using nvme (and those are ok to be always awake, it's just the mechanican HDD I want to be sleeping most of the time).
The model is WESTERN DIGITAL Red Plus, 12TB (WD120EFBX).

In general, I think there are certain things some linux components / systemd / KDE based components (like dolphin) seem to do that query all disks and therefor wake them up.

However, I already ensure the disk is in proper *standby* mode, not just less deep sleep  mode (I use hdparm -y with small y, not the one with large Y), which already prevents the disk from waking up by simpler queries about its state. But so somehow inserting a USB stick makes it manage to overcome even that and wake it up...

Last edited by aardwolf (2023-04-07 19:56:50)

Offline

#4 2023-04-07 19:56:29

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,681

Re: Inserting USB stick wakes up hard disk

"Desktop Environment" - overzealous because it wants to automagically respond to stuff.
The multi-user.target is systemd slang for runlevel 3, rescue is runlevel 1 - https://wiki.archlinux.org/title/SysVinit#Runlevels

The idea is that you plug the thumbdrive and some plasma daemon goes into action and triggers all storage devices.
To figure whether that might be the case, test the behavior w/ the multi-user.target.

Offline

#5 2023-04-07 20:00:03

aardwolf
Member
From: Belgium
Registered: 2005-07-23
Posts: 310

Re: Inserting USB stick wakes up hard disk

Since you mention plasma daemon, that certainly increases my suspicion it's KDE related (I use cinnamon, but of course various KDE/plasma stuff is typically installed anyway).

If I plugin a USB stick I do want to be able to access it, so some automation should happen! But not waking up *other* disks.

If this are plasma components, any idea how to configure them to not do this?

Offline

#6 2023-04-07 20:03:15

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,681

Re: Inserting USB stick wakes up hard disk

I mentioned plasma because you mentioned dolphin - cinnamon is just as suspicous.
But as first step you should rule out that this happens on a lower level, otherwise we'll end up chasing a wild goose.

Offline

#7 2023-04-08 11:07:26

aardwolf
Member
From: Belgium
Registered: 2005-07-23
Posts: 310

Re: Inserting USB stick wakes up hard disk

How can I see this? Should I look in systemd or udev somewhere? Is it config files, or something more complex from systemd?

Are there any components installed by default in a typical arch install that are likely to do it that I could focus on first?

Thanks!

Offline

#8 2023-04-08 11:20:50

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,043

Re: Inserting USB stick wakes up hard disk

https://wiki.archlinux.org/title/Systemd#Targets

Systemd on archlinux by default boots to graphical target. When you see the login screen many things  have already been started.

Please boot to multi-user.target which starts a minimal console environment, login to console .
plugin an usb stick, check if the hdd wakes up.
If yes, something on lower level causes it and the DE stuff is free from blame* (uncommon, but does happen) .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#9 2023-04-24 11:59:22

aardwolf
Member
From: Belgium
Registered: 2005-07-23
Posts: 310

Re: Inserting USB stick wakes up hard disk

I have still not done the booting to multi-user.target (it's not clear to me how I set that up, must I do this in the grub boot menu? Is it possible to switch when already booted? how to get back to graphical boot afterwards?)

However, using btrace, I know now that the cause of the spinning up of the hard drive, is udisks.

Does that make sense? If so, is there an alternative to udisks? Is it possible to completely uninstall udisks, and let something else handle the functionality of (auto-)mounting USB sticks, and the other things it does?

Or is udisks a too important non-replaceable part of archlinux, or of desktop environments?

Thanks!

Last edited by aardwolf (2023-04-24 12:00:59)

Offline

#10 2023-04-24 12:21:01

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,681

Re: Inserting USB stick wakes up hard disk

Did you visit the 2nd link below?

Udisks2 is a common dependency of gnome, kde and derivative DEs - and likely just the hub that gets triggered by somethingelse™ - in doubt your file browser or some desktop gadget.
Boot the multi-user.target, test the behavior.
Start the udisks2.service, test the behavior.
If it's not caused by the udisks2 service presence in the mutli-user.target (or maybe even at your login manager in your graphical.target) it's something in your desktop session.

Offline

#11 2023-04-24 16:47:58

Maniaxx
Member
Registered: 2014-05-14
Posts: 761

Re: Inserting USB stick wakes up hard disk

aardwolf wrote:

I already ensure the disk is in proper *standby* mode, not just less deep sleep  mode (I use hdparm -y with small y, not the one with large Y)

Rather looks like its exactly the other way round.

$ man hdparm
-y     Force an IDE drive to immediately enter the low power consumption standby mode, usually causing it to spin down.
       The current power mode status can be checked using the -C option.

-Y     Force an IDE drive to immediately enter the lowest power consumption sleep mode, causing it to  shut  down  com‐
       pletely.  A hard or soft reset is required before the drive can be accessed again (the Linux IDE driver will au‐
       tomatically handle issuing a reset if/when needed).  The current power mode status can be checked using  the  -C
       option.

'hdparm -Y' keeps working for me when plugging-in USB sticks (on XFCE with udisks2). Some 'pacman' hooks like '30-systemd-udev-reload.hook' ("Reloading device manager configuration...") still wake up the HDD though.

Last edited by Maniaxx (2023-04-24 16:50:14)


sys2064

Offline

Board footer

Powered by FluxBB