1 (edited by mfleetwo 2021-07-05 11:52:29)

Topic: GParted Live discrepancy

I was recently experimenting with something in an Arch install on a VM. Circumstances led to a comparison between a Gparted live session and a regular desktop session running GParted. What I saw surprised me and I am hoping someone can provide some insight into the descrepancy between the Used and Unused data for the two sessions.
My focus was on sda3, my root partition which at 6.0 GiB has the expected 5% of reserved blocks, so about 0.3 GiB. I get it that in the desktop session I am root and that it will report reserved blocks in the Unused total but this does not explain the 1.84 GiB difference or the fact that there are differences on the other ext4 partitions. In the live session I assume I am root too but I'm not entirely sure. I assume GParted in the live session is coded not to touch parts of the filesystem but I don't know what parts that might be. Can anyone help reconcile these differences?.

GParted Live:
Partition    File System    Mount Point    Size             Used             Unused
/dev/sda1    ext4                                   200 MiB        123.76 MiB    76.24 MiB
/dev/sda2    swap                                  3.0 GiB           0.0 B            3.0 GiB
/dev/sda3    ext4                                   6.0 GiB            5.97 GiB       27.66 MiB
/dev/sda4    ext4                                    1.8 GiB          1.20 GiB      620.02 MiB
GParted Desktop session:
Partition    File System    Mount Point    Size          Used            Unused
/dev/sda1    ext4              /boot             200 MiB        69.37 MiB    130.63 MiB
/dev/sda2    swap                                   3.0 GiB        0.0 B            3.0 GiB
/dev/sda3    ext4              /                     6.0 GiB          4.13 GiB      1.87 GiB
/dev/sda4    ext4              /home             1.8 GiB    710.92 MiB      1.11 GiB
Difference:
Partition    File System    Mount Point    Size          Used            Unused
/dev/sda1    ext4              /boot             0 MiB        54.39 MiB    -54.39 MiB
/dev/sda2    swap                                   0.0 GiB        0.0 B        0.0 GiB
/dev/sda3    ext4              /                     0.0 GiB        1.84 GiB    -1.84 GiB
/dev/sda4    ext4              /home             0.0 GiB        0.49 GiB    -0.49 GiB

Both the live and desktop sessions were running version 1.3.0. I see discrepancies on other machines too, although the numbers are different.


Edit: [mfleetwo] Update size of sda3 in GParted Desktop session from ".0 GiB" to "6.0 GiB" as I assume that was a typo.]

2

Re: GParted Live discrepancy

With GParted 0.32.0 and later it uses resize2fs to report the minimum size the file system can be shrunk as the used space.
(GParted after all only uses the used space figure to determine the minimum size it can shrink a file system).


I have no idea why the same version of GParted would report different used figures between a distro package release and the GParted Live release.


GParted uses the equivalent of this to work out the size of an ext[234] file system:

sudo dumpe2fs -h /dev/sda3 | egrep 'Block count|Block size'

and this to get the minimum size it can be shurk (AKA used figure):

sudo resize2fs -P /dev/sda3

If you want to investigate further try the above commands in both sessions.

3

Re: GParted Live discrepancy

Was the file system mounted in one situation, but not in the other?

If so then temporary files and such could account for the differences.

4

Re: GParted Live discrepancy

Hi mfleetwo, thanks for your reply.

Using your suggested commands in each session I get the same answer for used space at 5.97 GiB as seen in the live session in GParted. The desktop session still shows about 4.13 GiB used. The df -h command shows 4.0G

I see the same pattern on my Arch laptop. The / partition is 290.6 GiB. GParted live has 191.41GiB used and 99.19 GiB unused. GParted desktop has 190.34 GiB used and 100.27 GiB unused so the difference is about 1.08 GiB. Using your commands I get 191.41 GiB used in both the live and desktop sessions. These differences are not material on my laptop although they were on my VM for the test I was doing. I was just curious to understand what might be driving this difference.

Hi gedakc, thanks for your suggestion. I didn’t have the partition mounted in the live session and of course it was mounted in the desktop session. I tried mounting it in the live session and saw no changes to the data

5

Re: GParted Live discrepancy

While a file system is mounted GParted asks the kernel for the used space figure.  Hence the different used figures between the two sessions.

Unfortunately the used space and minimmm size an ext4 file system can be shrunk can differ by quite a bit.