Bug 501037 - Used space value inconsistent
Summary: Used space value inconsistent
Status: RESOLVED NOT A BUG
Alias: None
Product: partitionmanager
Classification: Applications
Component: general (show other bugs)
Version: 24.12.2
Platform: Solus Other
: NOR normal
Target Milestone: ---
Assignee: Andrius Štikonas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-04 01:24 UTC by Justin Zobel
Modified: 2025-03-05 19:26 UTC (History)
0 users

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 Justin Zobel 2025-03-04 01:24:52 UTC
SUMMARY
I have an encrypted btrfs volume on an external USB SSD. While it is unmounted it shows 55.02GB used. When it is mounted, it shows 5.02GB used. The partition is empty and 5.02GB is likely just journal information for the filesystem I guess.

STEPS TO REPRODUCE
I'm not even sure how this happens, it just exists on my drive.

OBSERVED RESULT
Used space differs between mounted and unmounted state of partition.

EXPECTED RESULT
Used space is the same whether the partition is mounted or unmounted.

Operating System: Solus 4.7
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.12.12-313.current (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 PRO 4750U with Radeon Graphics
Memory: 29.1 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: LENOVO
Product Name: 20Y1001SAU
System Version: ThinkPad P14s Gen 1
Comment 1 Andrius Štikonas 2025-03-04 19:25:01 UTC
Hmm, it uses different sources of data. I don't know which one would be correct in your case.

When partition is mounted QStorageInfo from Qt is used (https://doc.qt.io/qt-6/qstorageinfo.html) which under the hood calls statfs64 syscall and asks kernel how much space is used.

When partition is unmounted we call btrfs filesystem show --raw and parse that.

Presumably the first source is more accurate since it comes from the kernel...
Comment 2 Justin Zobel 2025-03-04 22:42:29 UTC
The 5.02GB one when mounted would be correct. There was no content in the drive.
Comment 3 Andrius Štikonas 2025-03-04 23:53:30 UTC
(In reply to Justin Zobel from comment #2)
> The 5.02GB one when mounted would be correct. There was no content in the
> drive.

Well, that's what we are using when that info is available. But then partition is unmounted, we can't use that.

So does sudo btrfs filesystem show --raw show wrong info for you if you run it manually?
Comment 4 Justin Zobel 2025-03-05 02:52:04 UTC
Unfortunately, that volume is now gone.

On my current system I see in Partition Manager:
125GiB of 472.94GiB

Via BTRFS:
sudo btrfs filesystem show --raw
Label: 'KDELinux'  uuid: 50a6d7b1-c8ee-4aeb-b1ce-3b8376e836be
        Total devices 1 FS bytes used 126785499136
        devid    1 size 507794214912 used 134242893824 path /dev/mapper/root

And those numbers seem to match up, but that partition is mounted.
Comment 5 Andrius Štikonas 2025-03-05 19:26:48 UTC
Anyway, not much we can do in partitionmanager itself here (especially if the btrfs tool was inaccurate). We use better source (kernel info) when it is available...