Bug 505852 - Mounting a removable disk (BTFS / EXT4) systematically forces a very long scan, leading to a timeout
Summary: Mounting a removable disk (BTFS / EXT4) systematically forces a very long sca...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Disks & Devices widget (other bugs)
Version First Reported In: 6.4.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: efficiency-and-performance, regression
Depends on:
Blocks:
 
Reported: 2025-06-20 15:27 UTC by Sigmund
Modified: 2025-07-24 13:06 UTC (History)
14 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.5.0
Sentry Crash Report:


Attachments
It is slow. (179.99 KB, video/mp4)
2025-06-20 15:27 UTC, Sigmund
Details
Logs of devicenotifier. (37.73 KB, text/plain)
2025-06-21 11:34 UTC, Sigmund
Details
workaround (134.72 KB, image/png)
2025-06-23 09:39 UTC, Vence
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sigmund 2025-06-20 15:27:46 UTC
Created attachment 182428 [details]
It is slow.

SUMMARY
It is slow while I mount the removable disk(btrfs) in plasma 6.4.  Maybe a bug. 

STEPS TO REPRODUCE
1. Mount a removable disk
2. It checks it every time.

OBSERVED RESULT
It checks it every time.

EXPECTED RESULT
Hope it can be mounted as fast as before.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.4.0
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.1
Kernel Version: 6.15.2-zen1-1-zen (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
Comment 1 Yujiro Hanma 2025-06-20 15:45:38 UTC
It seems it's due to the new feature of checking disks for errors by default. For me it either outright fails or has an error message like 

An error occurred while accessing 'LinuxDisk', the system responded: An unspecified error has occurred: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

After trying twice, it ultimately succeeds, despite the errors.
Comment 2 Bogdan Onofriuchuk 2025-06-21 11:24:13 UTC
Can you collect the logs please, because I don't have any disks. 
1. In terminal execute: QT_LOGGING_RULES="org.kde.applets.devicenotifier=true" plasmawindowed org.kde.plasma.devicenotifier &> log.txt
2. Reproduce the bug
3. stop the process in terminal
4. attach the file log.txt here
Comment 3 Sigmund 2025-06-21 11:34:07 UTC
Created attachment 182481 [details]
Logs of devicenotifier.

Add logs.
Comment 4 Bogdan Onofriuchuk 2025-06-21 12:24:28 UTC
Looks like this is expected behavior. Before mounting it checks the device for errors. The slowness of checking is proportional to the disk size and read speed. You have a 2Tb drive so that why it is so slow. The solution here would be to make the check operation optional.
Comment 5 Sigmund 2025-06-22 10:08:11 UTC
(In reply to Bogdan Onofriuchuk from comment #4)
> Looks like this is expected behavior. Before mounting it checks the device
> for errors. The slowness of checking is proportional to the disk size and
> read speed. You have a 2Tb drive so that why it is so slow. The solution
> here would be to make the check operation optional.

Thanks. 

Hope it can be an optional choice.
Comment 6 Vence 2025-06-23 07:25:39 UTC
(In reply to Sigmund from comment #5)
> (In reply to Bogdan Onofriuchuk from comment #4)
> > Looks like this is expected behavior. Before mounting it checks the device
> > for errors. The slowness of checking is proportional to the disk size and
> > read speed. You have a 2Tb drive so that why it is so slow. The solution
> > here would be to make the check operation optional.
> 
> Thanks. 
> 
> Hope it can be an optional choice.

Is it possible to disable the this check? 

But how
Comment 7 Vence 2025-06-23 09:35:45 UTC
A workaround is suggested. 
Open System settings -- > Connected devices --> Disks & Cameras --> Device actions", add new action by the button "Add", give it any non-existing name and then enter the data as shown in the screenshot attached.
Use new action instead of "Mount" to mount the removable disk.
Comment 8 Vence 2025-06-23 09:39:40 UTC
Created attachment 182549 [details]
workaround

Sorry, no screenshot is attached in my previous comment
A workaround is suggested. 
Open System settings -- > Connected devices --> Disks & Cameras --> Device actions", add new action by the button "Add", give it any non-existing name and then enter the data as shown in the screenshot attached.
Use new action instead of "Mount" to mount the removable disk.
Comment 9 Mahendra Tallur 2025-06-23 17:52:51 UTC
Hi ! Same issue since the 6.4 upgrade, with an USB harddrive with ext 4 partitions. 
Actually, I have waited several minutes to no avail and had to reboot :-/

Is it really the expected behaviour ?

For some reason, the check does not occur when mounting the partition through Dolphin. (pfew !)
Comment 10 Mahendra Tallur 2025-06-23 17:56:11 UTC
BTW, may I suggest the bug report name is changed accordingly, to something like :

"Mounting a removable hadrrive (BTFS / EXT4) systematically forces a very long scan, leading to a timeout".

I really wonder if that is the expected behaviour...
Comment 11 Martin Schnitkemper 2025-06-24 12:05:48 UTC
I can confirm this behavior. Mounting a fully loaded 4TB external hard drive now takes four minutes, during that time I can hear the drive activity. After about a minute, I get a message saying I'm not authorized to mount the device. After the four minutes, I see in the log that the device has been mounted. This is new since version 6.4; before, mounting the device was done instantly, and when I mount the device on the console as root, it's done immediately.
Comment 12 Bug Janitor Service 2025-06-24 16:29:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5624
Comment 13 Grósz Dániel 2025-07-01 10:18:45 UTC
Happens here too, with an almost full, 2 TB BTRFS hard disk. The extreme slowness is new. The btrfsck check takes 20 minutes. Mounting was somewhat slow earlier too (maybe half a minute); Idk if it's the plasma shell's behavior that changed, or perhaps the default operation of btrfsck became much slower, or perhaps Solid via udisks now reports that it can check the drive, while previously it couldn't.

Also note that btrfsck doesn't even repair anything by default, its repair functionality is considered unsafe, while AFAIK btrfs automatically repairs errors that can be safely repaired when mounting, so btrfsck should be unnecessary.

Perhaps a reasonable behavior would be to try mounting first, and only fsck (with no timeout) if mounting fails with an error that indicates that the file system is damaged, and then try to mount again. Even then, ideally only run fsck if the file system has an fsck tool that can safely repair some kinds of errors, otherwise just report that the file system is damaged (Idk if there's a way to get this information from udisks).
Comment 14 Bogdan Onofriuchuk 2025-07-14 19:01:04 UTC
Git commit a30f314d9fe646080f314f2070489ec897467c43 by Bohdan Onofriichuk.
Committed on 14/07/2025 at 18:14.
Pushed by littlesweet into branch 'master'.

applets/devicenotifier: don't do check in mount action

Don't do check in the mount action. Create another action for check. Also
change the name of the mount action to just "mount" if check was done.

M  +1    -0    applets/devicenotifier/CMakeLists.txt
A  +82   -0    applets/devicenotifier/actions/checkaction.cpp     [License: GPL(v2.0+)]
C  +5    -9    applets/devicenotifier/actions/checkaction.h [from: applets/devicenotifier/actions/mountaction.h - 059% similarity]
M  +8    -19   applets/devicenotifier/actions/mountaction.cpp
M  +0    -1    applets/devicenotifier/actions/mountaction.h
M  +10   -1    applets/devicenotifier/actionscontrol.cpp
M  +5    -2    applets/devicenotifier/devicemessagemonitor_p.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/a30f314d9fe646080f314f2070489ec897467c43
Comment 15 Christian Hartmann 2025-07-23 11:27:48 UTC
(In reply to Martin Schnitkemper from comment #11)
> I can confirm this behavior. Mounting a fully loaded 4TB external hard drive
> now takes four minutes, during that time I can hear the drive activity.
> After about a minute, I get a message saying I'm not authorized to mount the
> device. After the four minutes, I see in the log that the device has been
> mounted. This is new since version 6.4; before, mounting the device was done
> instantly, and when I mount the device on the console as root, it's done
> immediately.

Same here, but with a 4 TB drive on USB 2 it takes up to two hours.

Has the default action "Mount and Open" changed lately to "*Always* do a check first 
and mount after" behavior?  

Does it ignore a 'clean' flag in partitions super block (if something like this exists)?

more observations: https://discuss.kde.org/t/mounting-external-usb-disks-now-checks-before-mounting/37439/2
Comment 16 Christian Hartmann 2025-07-23 14:00:09 UTC
(In reply to Mahendra Tallur from comment #9)
 
> For some reason, the check does not occur when mounting the partition
> through Dolphin. (pfew !)

Can confirm this. It is only the Widget,  that checks before mounting.  Dolphin mounts immediately without any complaints, a clean unmounted disk, whereas the default action triggers checking.  I miss seeing the point in doing so, when the drive is clean - without errors.