Bug 440477 - Total Disk Space is wrongly detected
Summary: Total Disk Space is wrongly detected
Status: RESOLVED FIXED
Alias: None
Product: plasma-systemmonitor
Classification: Applications
Component: general (show other bugs)
Version: 5.22.4
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: KSysGuard Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-01 07:13 UTC by Kishore Gopalakrishnan
Modified: 2021-08-30 09:28 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kishore Gopalakrishnan 2021-08-01 07:13:44 UTC
SUMMARY
The 'Overview' page shows wrong values for the used disk space and total disk space on my machine. The values it shows are
Used: 1.6 TB
Total: 2.1 TB

However, I only have around 1.5 TB of total space on my machine (the two disks 'sda' and 'nvme0n1' below). Here is the lsblk output on my machine:

```
$lsblk -o NAME,SIZE,TYPE                                                                                                               
NAME                         SIZE TYPE
sda                        931.5G disk
└─sda1                     931.5G part
  └─Files                  931.5G crypt
nvme0n1                    476.9G disk
├─nvme0n1p1                  487M part
└─nvme0n1p2                476.4G part
  └─cryptlvm               476.4G crypt
    ├─VolGroup-swap           14G lvm
    ├─VolGroup-root           45G lvm
    ├─VolGroup-home          160G lvm
    ├─VolGroup-Dump          100G lvm
    └─VolGroup-testbedRoot    20G lvm
```

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2
Kernel Version: 5.10.54-1-lts (64-bit)
Graphics Platform: X11

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2021-08-02 20:40:28 UTC
Out of curiosity, whose numbers do Dolphin and KIO agree with? Or are those different too?
Comment 2 Kishore Gopalakrishnan 2021-08-03 04:38:03 UTC
(In reply to Nate Graham from comment #1)
> Out of curiosity, whose numbers do Dolphin and KIO agree with? Or are those
> different too?

Dolphin detects the size of the individual partitions correctly. I don't know where I can check what size is detected by KIO. 

I have a hunch that it may be related to my using LVM+LUKS. I'll update the report this weekend after doing some experiments in a VM.
Comment 3 David Redondo 2021-08-06 11:20:20 UTC
Hi, can you provide the output of 'kstatsviewer --list | grep disk'?
Comment 4 Kishore Gopalakrishnan 2021-08-06 11:33:24 UTC
(In reply to David Redondo from comment #3)
> Hi, can you provide the output of 'kstatsviewer --list | grep disk'?

disk/200de956-727b-4267-9917-ab591c2b08a5/read Root Read Rate
disk/a84a86a5-4e3b-4d1b-bfca-5d4e39069624/free EbookDump Free Space
disk/a84a86a5-4e3b-4d1b-bfca-5d4e39069624/used EbookDump Used Space
disk/9e40bfb3-99af-4ecf-bd9a-188e3f706274/used Files_part Used Space
disk/cd686685-e17a-4d1e-9ceb-1e1be30a65f9/freePercent 931.5 GiB Encrypted Drive Percentage Free
disk/200de956-727b-4267-9917-ab591c2b08a5 Root
disk/83578556-27bc-4dac-9d45-9b2ab7e930cd/read Home Read Rate
disk Disks
disk/83578556-27bc-4dac-9d45-9b2ab7e930cd/name Name
disk/cd686685-e17a-4d1e-9ceb-1e1be30a65f9/name Name
disk/9e40bfb3-99af-4ecf-bd9a-188e3f706274/write Files_part Write Rate
disk/200de956-727b-4267-9917-ab591c2b08a5/free Root Free Space
disk/9e40bfb3-99af-4ecf-bd9a-188e3f706274/read Files_part Read Rate
disk/9e40bfb3-99af-4ecf-bd9a-188e3f706274/total Files_part Total Space
disk/a84a86a5-4e3b-4d1b-bfca-5d4e39069624/usedPercent EbookDump Percentage Used
disk/all/read Read Rate
disk/83578556-27bc-4dac-9d45-9b2ab7e930cd/usedPercent Home Percentage Used
disk/all/free Free Space
disk/83578556-27bc-4dac-9d45-9b2ab7e930cd/write Home Write Rate
disk/200de956-727b-4267-9917-ab591c2b08a5/write Root Write Rate
disk/9e40bfb3-99af-4ecf-bd9a-188e3f706274 Files_part
disk/cd686685-e17a-4d1e-9ceb-1e1be30a65f9/used 931.5 GiB Encrypted Drive Used Space
disk/9e40bfb3-99af-4ecf-bd9a-188e3f706274/freePercent Files_part Percentage Free
disk/cd686685-e17a-4d1e-9ceb-1e1be30a65f9/write 931.5 GiB Encrypted Drive Write Rate
disk/cd686685-e17a-4d1e-9ceb-1e1be30a65f9/total 931.5 GiB Encrypted Drive Total Space
disk/83578556-27bc-4dac-9d45-9b2ab7e930cd Home
disk/all/freePercent Percentage Free
disk/cd686685-e17a-4d1e-9ceb-1e1be30a65f9/usedPercent 931.5 GiB Encrypted Drive Percentage Used
disk/cd686685-e17a-4d1e-9ceb-1e1be30a65f9/free 931.5 GiB Encrypted Drive Free Space
disk/9e40bfb3-99af-4ecf-bd9a-188e3f706274/free Files_part Free Space
disk/a84a86a5-4e3b-4d1b-bfca-5d4e39069624/freePercent EbookDump Percentage Free
disk/a84a86a5-4e3b-4d1b-bfca-5d4e39069624 EbookDump
disk/200de956-727b-4267-9917-ab591c2b08a5/usedPercent Root Percentage Used
disk/83578556-27bc-4dac-9d45-9b2ab7e930cd/used Home Used Space
disk/all All Disks
disk/a84a86a5-4e3b-4d1b-bfca-5d4e39069624/write EbookDump Write Rate
disk/9e40bfb3-99af-4ecf-bd9a-188e3f706274/usedPercent Files_part Percentage Used
disk/all/usedPercent Percentage Used
disk/83578556-27bc-4dac-9d45-9b2ab7e930cd/freePercent Home Percentage Free
disk/a84a86a5-4e3b-4d1b-bfca-5d4e39069624/total EbookDump Total Space
disk/200de956-727b-4267-9917-ab591c2b08a5/used Root Used Space
disk/200de956-727b-4267-9917-ab591c2b08a5/freePercent Root Percentage Free
disk/all/write Write Rate
disk/9e40bfb3-99af-4ecf-bd9a-188e3f706274/name Name
disk/83578556-27bc-4dac-9d45-9b2ab7e930cd/free Home Free Space
disk/cd686685-e17a-4d1e-9ceb-1e1be30a65f9/read 931.5 GiB Encrypted Drive Read Rate
disk/all/used Used Space
disk/all/total Total Space
disk/200de956-727b-4267-9917-ab591c2b08a5/total Root Total Space
disk/a84a86a5-4e3b-4d1b-bfca-5d4e39069624/name Name
disk/a84a86a5-4e3b-4d1b-bfca-5d4e39069624/read EbookDump Read Rate
disk/83578556-27bc-4dac-9d45-9b2ab7e930cd/total Home Total Space
disk/200de956-727b-4267-9917-ab591c2b08a5/name Name
disk/cd686685-e17a-4d1e-9ceb-1e1be30a65f9 931.5 GiB Encrypted Drive
Comment 5 David Redondo 2021-08-06 11:48:02 UTC
I see wee have both 

disk/cd686685-e17a-4d1e-9ceb-1e1be30a65f9/free 931.5 GiB Encrypted Drive Free Space
disk/9e40bfb3-99af-4ecf-bd9a-188e3f706274/free Files_part Free Space


which I  assume from judging your setup is both sda1
Comment 6 Kishore Gopalakrishnan 2021-08-08 05:45:11 UTC
(In reply to David Redondo from comment #5)
> I see wee have both 
> 
> disk/cd686685-e17a-4d1e-9ceb-1e1be30a65f9/free 931.5 GiB Encrypted Drive
> Free Space
> disk/9e40bfb3-99af-4ecf-bd9a-188e3f706274/free Files_part Free Space
> 
> 
> which I  assume from judging your setup is both sda1

Yep. Here are the details of the labels and UUIDs.

```
$lsblk -o NAME,SIZE,TYPE,LABEL,UUID                                                                                                            
NAME                         SIZE TYPE  LABEL       UUID
sda                        931.5G disk              
└─sda1                     931.5G part              cd686685-e17a-4d1e-9ceb-1e1be30a65f9
  └─Files                  931.5G crypt Files_part  9e40bfb3-99af-4ecf-bd9a-188e3f706274
nvme0n1                    476.9G disk              
├─nvme0n1p1                  487M part              C3D3-7627
└─nvme0n1p2                476.4G part              f8098d35-a5de-4215-809e-07ab1f3a0f7d
  └─cryptlvm               476.4G crypt             GEJbut-jdyC-xLqC-VwB0-hqSo-0s8H-ZN8HDd
    ├─VolGroup-swap           14G lvm               9aa88c34-2a85-47ed-9763-62b7e5b6bd1a
    ├─VolGroup-root           45G lvm   Root        200de956-727b-4267-9917-ab591c2b08a5
    ├─VolGroup-home          160G lvm   Home        83578556-27bc-4dac-9d45-9b2ab7e930cd
    ├─VolGroup-Dump          100G lvm   EbookDump   a84a86a5-4e3b-4d1b-bfca-5d4e39069624
    └─VolGroup-testbedRoot    20G lvm   testbedRoot ba2d45f4-0e17-4289-a4af-599328650523
```
Comment 7 David Redondo 2021-08-16 08:51:46 UTC
Ok to confirm my theory and for fixing this could you provide the output of 
'solid-hardware5 details $id' 
where id is the id of sda1/Files partition respectively. 

To find out the ids you can run 
'solid-hardware5 query "is StorageAccess"'
 which should list the ids of all the partitions, the sda1 id would probably be 
'/org/freedesktop/UDisks2/block_devices/sda1'

So the resulting command would be 
solid-hardware5 details /org/freedesktop/UDisks2/block_devices/sda1

Unfortunately I don't know what the id for "Files" would look like so i can't give you the complete command to run, so the above process.
Comment 8 Kishore Gopalakrishnan 2021-08-16 09:10:09 UTC
(In reply to David Redondo from comment #7)
> Ok to confirm my theory and for fixing this could you provide the output of 
> 'solid-hardware5 details $id' 
> where id is the id of sda1/Files partition respectively. 
> 
> To find out the ids you can run 
> 'solid-hardware5 query "is StorageAccess"'
>  which should list the ids of all the partitions, the sda1 id would probably
> be 
> '/org/freedesktop/UDisks2/block_devices/sda1'
> 
> So the resulting command would be 
> solid-hardware5 details /org/freedesktop/UDisks2/block_devices/sda1
> 
> Unfortunately I don't know what the id for "Files" would look like so i
> can't give you the complete command to run, so the above process.

$solid-hardware5 details '/org/freedesktop/UDisks2/block_devices/sda1'
udi = '/org/freedesktop/UDisks2/block_devices/sda1'
  parent = '/org/freedesktop/UDisks2/drives/WDC_WD10SPZX_00Z10T0_WD_WXC1AB91R467' (string)
  vendor = '' (string)
  product = 'WDC WD10SPZX-00Z10T0' (string)
  description = '931.5 GiB Encrypted Drive' (string)
  icon = 'drive-harddisk' (string)
  Block.major = 8  (0x8)  (int)
  Block.minor = 1  (0x1)  (int)
  Block.device = '/dev/sda1' (string)
  StorageAccess.accessible = true (bool)
  StorageAccess.filePath = '/run/media/kishore/files_internal_HDD' (string)
  StorageAccess.ignored = false (bool)
  StorageAccess.encrypted = true (bool)
  StorageVolume.ignored = false (bool)
  StorageVolume.usage = 'Encrypted'  (0x5)  (enum)
  StorageVolume.fsType = 'crypto_LUKS' (string)
  StorageVolume.label = '' (string)
  StorageVolume.uuid = 'cd686685-e17a-4d1e-9ceb-1e1be30a65f9' (string)
  StorageVolume.size = 1000200994816  (0xe8e0a00000)  (qulonglong)

$solid-hardware5 details '/org/freedesktop/UDisks2/block_devices/dm_2d6'
udi = '/org/freedesktop/UDisks2/block_devices/dm_2d6'
  parent = '/' (string)
  vendor = '' (string)
  product = '' (string)
  description = 'Files_part' (string)
  icon = 'drive-harddisk' (string)
  Block.major = 254  (0xfe)  (int)
  Block.minor = 6  (0x6)  (int)
  Block.device = '/dev/dm-6' (string)
  StorageAccess.accessible = true (bool)
  StorageAccess.filePath = '/run/media/kishore/files_internal_HDD' (string)
  StorageAccess.ignored = false (bool)
  StorageAccess.encrypted = true (bool)
  StorageVolume.ignored = false (bool)
  StorageVolume.usage = 'FileSystem'  (0x2)  (enum)
  StorageVolume.fsType = 'ext4' (string)
  StorageVolume.label = 'Files_part' (string)
  StorageVolume.uuid = '9e40bfb3-99af-4ecf-bd9a-188e3f706274' (string)
  StorageVolume.size = 1000198897664  (0xe8e0800000)  (qulonglong)
Comment 9 David Redondo 2021-08-30 09:28:26 UTC
Git commit 7ba84277a67a5df5320ac42a8c265dc8960eb697 by David Redondo.
Committed on 30/08/2021 at 09:28.
Pushed by davidre into branch 'master'.

Only add a new VolumeObject if there's no other one with the same mounting point

Can happen with encrypted partition setups

M  +19   -7    plugins/disks/disks.cpp
M  +1    -0    plugins/disks/disks.h

https://invent.kde.org/plasma/ksystemstats/commit/7ba84277a67a5df5320ac42a8c265dc8960eb697