Bug 497671 - Dolphin should remove old/unused thumbnails to avoid too high disk space usage
Summary: Dolphin should remove old/unused thumbnails to avoid too high disk space usage
Status: CONFIRMED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 22.12.3
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-19 06:29 UTC by Petr N.
Modified: 2024-12-27 13:43 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr N. 2024-12-19 06:29:16 UTC
SUMMARY

Thumbnail cache (du -h ~/.cache/thumbnails|sort -h)
can grow to around 10GB+ https://forums.debian.net/viewtopic.php?t=154081

by default "keep only thumbnails for the folders visited in last 3 months and remove rest"

"this really ought to be a configurable setting/feature with Dolphin"

Impact:
1. cleanup thumbnails for files that no longer exist.
2. avoid taking too much disk space for the files that are not really used in months

Maybe the cleanup can be done if the drive usage exceeds some threshold like 80% or regularly, but rarely (during shutdown etc.) not to cause slowdowns due to too many IO operations.

Some file systems/mountpoints does not use atime.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian 12, all stable
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Comment 1 Felix Ernst 2024-12-22 01:00:01 UTC
I agree that an option for this would be great, but I currently don't see how one would implement this. The information if a thumbnail was used would need to be saved, but storing information on disk any time a thumbnail is loaded seems like a huge number of writes and disk wear for very little gain. We don't want to stress the disk when a user is only navigating between folders.
Comment 2 Petr N. 2024-12-26 06:30:26 UTC
If Dolphin already creates some ram based index (i am unsure how big it can be for lets say 50 million image files) of of files and its thumbnails, maybe next parameter of such index may be last date+time when the file/thumbnail parent folder has been accessed. Or this information be stored somewhere else. And the thumbnail garbage collector would process folders based on its last access date/time and delete its child thumbnails if the access date/time is too old. Sorry, I know nothing about programming.
Comment 3 Felix Ernst 2024-12-27 13:43:36 UTC
(In reply to Petr N. from comment #2)
> If Dolphin already creates some ram based index

The data needs to be stored in permanent storage eventually so we still would have the issue of extra wear on the hardware just by navigating the file system.

> date+time when the file/thumbnail parent folder has been accessed

Saving the information only once per parent folder would not work with the current implementation because we do not store thumbnails by parent folder. The stored thumbnails do not contain information about where their respective file is. The thumbnail is stored per file so no matter where the file is encountered, we will be able to load the thumbnail. There might also be privacy concerns if from the thumbnails alone one could identify both when the file was last opened as well as where the file is stored.

In any case I will mark the bug report as CONFIRMED because I think it is a fair request even if I don't know how one would proceed here.