Noticeable lag on saving/opening files and folders - HDD possibly spinning up/down too frequently?

A couple months ago, I upgraded kernels on desktop PC from 5.4.231-1 to 6.1.12-1.

Since then, I’ve been experiencing lag spikes in various places - opening folders in Dolphin, editing and saving files in Kate and (spac)emacs, etc takes a few seconds every so often. Even things like running org-clock-in can trigger this lag.

I’ve noticed that most every time this happens, I hear my internal storage HDD spinning up (WD Black), where I frequently save files. Manjaro is installed on a separate SSD.

$ sudo dmesg -T | tail -n 100 | grep disk
[Sat Apr 15 19:02:28 2023] sd 0:0:0:0: [sda] Stopping disk
[Sat Apr 15 19:03:42 2023] sd 0:0:0:0: [sda] Starting disk
[Sat Apr 15 19:04:00 2023] sd 0:0:0:0: [sda] Stopping disk
[Sat Apr 15 19:09:39 2023] sd 0:0:0:0: [sda] Starting disk
[Sat Apr 15 19:09:58 2023] sd 0:0:0:0: [sda] Stopping disk
[Sat Apr 15 19:19:39 2023] sd 0:0:0:0: [sda] Starting disk
[Sat Apr 15 19:19:58 2023] sd 0:0:0:0: [sda] Stopping disk
[Sat Apr 15 19:29:39 2023] sd 0:0:0:0: [sda] Starting disk
[Sat Apr 15 19:29:58 2023] sd 0:0:0:0: [sda] Stopping disk
[Sat Apr 15 19:39:39 2023] sd 0:0:0:0: [sda] Starting disk
[Sat Apr 15 19:39:58 2023] sd 0:0:0:0: [sda] Stopping disk

Seems like it’s starts, then stops a few seconds later. Then when I need to write something to disk, it needs to spin up again.

$ sudo hdparm -I /dev/sda | grep level
        Advanced power management level: 128

$ cat /sys/block/sda/device/power/autosuspend_delay_ms

APM level is 128, which according to hdparm documentation should “not permit spin-down”.

The autosuspend_delay_ms setting is 15 seconds here, not sure if this is normal/default or not. I’ve tried editing this value manually but ran into some readonly issues, so not sure if there’s a proper way to do that.

Anyone have any ideas on what could be the cause of this, or experienced something similar? Before upgrading there was never much lag at all.

You must have some sort of power-saving software installed — tlp perhaps? — because on my system here, also with kernel 6.1, I get this… :arrow_down:

[aragorn] > cat /sys/block/sda/device/power/autosuspend_delay_ms

It causes more wear to a HDD to have it spin up and down all the time — spindle motor load and head wear due to friction during landing and takeoff — than to keep the thing spinning the whole time. In my case, it’s spinning 24/7, because I normally never power down the computer — UNIX was designed to stay up and running 24/7 anyway.

1 Like

you can disable it altoghether by explicitly setting it to 255. refer;

1 Like

I have a small Headless Raspberry Pi I use for that. One with Ubuntu Server LTS. My reason for this is simple: electricity use.

My computer has a 950 Watt PSU. OK, I deliberately oversized it when I built the computer, it probably uses closer to 400 Watts.

The Raspberry Pi uses less than 10 Watts, IIRC. Which is a BIG difference, especially regarding costs and my solar…

But Ubuntu is still Linux, so yeah…

1 Like

You’re right, I did have tlp installed. Must’ve been installed as part of a system update or something.

The settings didn’t look that unreasonable, save for maybe AHCI_RUNTIME_PM_TIMEOUT which was set to 15, but AHCHI_RUNTIME_PM_ON_AC wasn’t enabled in the first place.

Do you think it’s worth fiddling with the TLP settings, or is it better to just uninstall it since I’m on desktop?

Either way, I’ll keep observing the lag effects for now.

Unless things have changed in the meantime, it comes installed by default, except perhaps in the Minimal .isos.

Personally I would uninstall it. I did that on my machine as well. :wink:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.