Software Manager and df show different amount of available hard disk space

Software Manager shows hdd free space in the bottom right corner, and reads 8.25 Gb. But “df -h” in terminal shows

user@linux-loyv:~> df -h
S.ficheros     Tamaño Usados  Disp Uso% Montado en
devtmpfs         2.0G   8.0K  2.0G   1% /dev
tmpfs            2.0G    88K  2.0G   1% /dev/shm
tmpfs            2.0G   3.6M  2.0G   1% /run
/dev/sda6         20G    12G  7.3G  62% /
tmpfs            2.0G      0  2.0G   0% /sys/fs/cgroup
tmpfs            2.0G   3.6M  2.0G   1% /var/lock
tmpfs            2.0G   3.6M  2.0G   1% /var/run
/dev/sda3         82G    26G   56G  32% /Windows_data
/dev/sda2         43G    26G   18G  60% /Windows

You can see my Linux partition is obviously sda6, right?
What’s happening?

Maybe the old GB (powers of 1000) vs. GiB (powers of 1024) issue?

What does “df -H” say in comparison to the software manager?

Typically, a file system can fill to around 105%. At 100%, non-root users can no longer write, but the root user still can.

I’m guessing that Yast is showing what is available to the root user.

I think that is not true. You can not fill anything above 100%, not even a file system :wink:

It depends on the file system type and the default and if it is changed, but indeed a default ext2/3/4 file system (and many more) stop giving out disk blocks to “nornal” users when the file system has 5% or less free (and that 5% can be re-configured larger or smaller with e.g. tune2fs at any moment). It will allocate to root owned processes however.

But df does not take this konwledge into account. You can test this very easy by running df as user and as root and compare.

On 2014-05-19 21:36, F style wrote:
>
> Software Manager shows hdd free space in the bottom right corner, and
> reads 8.25 Gb. But “df -h” in terminal shows
>
> Code:
> --------------------
> user@linux-loyv:~> df -h
> S.ficheros Tamaño Usados Disp Uso% Montado en
> /dev/sda6 20G 12G 7.3G 62% /
> --------------------
>
> You can see my Linux partition is obviously sda6, right?
> What’s happening?

I concur with wolfi323.

Run “df” with “-h”, “-H”, and none, and compare them. See mine:


minas-tirith:~ # df -h /dev/sda7
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda7        30G   14G   16G  46% /
minas-tirith:~ # df -H /dev/sda7
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda7        32G   14G   17G  46% /
minas-tirith:~ # df  /dev/sda7
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda7       30830592 13656256  16119932  46% /
minas-tirith:~ #

Notice that df is not using “standards compliant” units. The first time,
with “-h”, the units should be written as “GiB”, and with “-H” it should
write “GB”. Notice how different are the numbers.

Then compare which one matches what the software manager says… which
may also be giving the wrong units.

And anyway, df is calculating things badly. My 30830592 K (k-what? KiB
or KB?). So one more try, forcing it to give bytes:


minas-tirith:~ # df --block-size=1 /dev/sda7
Filesystem       1B-blocks        Used   Available Use% Mounted on
/dev/sda7      31570526208 13984174080 16506642432  46% /

31570526208 B is 30830592 KiB, and is 30108 MiB, and is 29.40 GiB - not
the “30” it gives on the first line, nor the 32 it gives on the second.
Well, the second one… 31.57 does round to 32, so that one IS correct.
But 29.40 GiB should round down, not up, to 29.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

I’ve seen a file system at 104% on Solaris.

Shut down laptop, went out for a while, came back, turned on laptop, and did second attempt.
Software Manager: now reads 8.41 Gib free remaining space (it was always Gib, not Gb, sorry…)
Terminal:

user@linux-loyv:~> df /dev/sda6
Filesystem      1K-blocks    Used      Available   Use% Mounted in
/dev/sda6       20785020  11963032   7766144     61%   /
user@linux-loyv:~> df -h /dev/sda6
Filesystem      Size  Used    Available   Use% Mounted in
/dev/sda6        20G   12G       7.5G        61%   /
user@linux-loyv:~> df -H /dev/sda6
Filesystem      Size  Used    Available   Use% Mounted in
/dev/sda6        22G   13G       8.0G        61%   /
user@linux-loyv:~> su
Password:
linux-loyv:/home/user # df /dev/sda6
Filesystem      1K-blocks  Used         Available   Use% Mounted in
/dev/sda6        20785020  11963236   7765940    61%   /

df -h and df -H were the exact same in root as with user. Only df’s output changed as root.
As you can see, it’s not that close to what Software Manager throws…

On Mon, 19 May 2014 23:56:02 +0000, nrickert wrote:

> hcvv;2644253 Wrote:
>> I think that is not true. You can not fill anything above 100%, not
>> even a file system :wink:
>>
>>
> I’ve seen a file system at 104% on Solaris.

I’ve seen this as well.

Typically, it’s done by the software being told that 95% of the space is
actually 100% for normal users. So, if a disk is 1 TiB, 950 MiB will be
considered “full” by the operating system for normal users.

I’ve also seen compressed filesystems report usage based on uncompressed
space used, and you can end up with some really silly utilizations there

  • 150% utilization of space, for example, or 200% (if you’re getting
    pretty good compression across the board).

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

Yer correct, H. rotfl!

On Tue, 20 May 2014 01:26:02 +0000, F style wrote:

> df -h and df -H were the exact same in root as with user. Only df’s
> output changed as root.
> As you can see, it’s not that close to what Software Manager throws…

What filesystem is used for the root filesystem?

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

Very strange indeed and physicaly impossible.

Maybe Solaris was better in maths when it still was SunOS :wink:

The info page on my openSUSE says:

`pcent’
Percentage of USED divided by SIZE.

I still doubt that that can reach above 100%.

On 2014-05-20 12:36, hcvv wrote:
>
> nrickert;2644297 Wrote:
>> I’ve seen a file system at 104% on Solaris.
> Very strange indeed and physicaly impossible.

If you define 100% as what users can take, the extra 4% is the safety
guard for root.

Just a guess.

>
> Maybe Solaris was better in maths when it still was SunOS :wink:
>
> The info page on my openSUSE says:
>> `pcent’
>> Percentage of USED divided by SIZE.
> I still doubt that that can reach above 100%.

But if size is (real_size - safety_root_guard), then it can :slight_smile:


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

As the proof of the pudding is in the eating …

boven:~ # df /dev/sda6
Filesystem     1K-blocks  Used Available Use% Mounted on
devtmpfs         1009712    48   1009664   1% /dev
boven:~ #

Which shows that thh file system on /dev/sda6 is only 1% full.

boven:~ # tune2fs -l /dev/sda6 | grep Reserved
Reserved block count:     1310702
Reserved GDT blocks:      1017
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
boven:~ #

Which shows not the percentage, but the number of blocks reserved (and also who may use those blocks, but that is not very relevant here).
Now we do:

boven:~ # tune2fs -m 50 /dev/sda6
tune2fs 1.42.8 (20-Jun-2013)
Setting reserved blocks percentage to 50% (13107027 blocks)
boven:~ #

And we check:

boven:~ # tune2fs -l /dev/sda6 | grep Reserved
Reserved block count:     13107027
Reserved GDT blocks:      1017
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
boven:~ #

When the assumption that this is token into account by df in calculatting the usage % is true, we must ne able to see this:

boven:~ # df /dev/sda6
Filesystem     1K-blocks  Used Available Use% Mounted on
devtmpfs         1009712    48   1009664   1% /dev
boven:~ #

But nothing changed there.

QED from my point of view.

Remark: df shows this file system as being mounted at /dev. This is not the case. It is not mounted at all, it seems to be a sort of space filler created by df.

Wrong.

“df /dev/sda6” actually shows the free space of your /dev partition (which is of type devtmpfs), because the file /dev/sda6 is located on /dev. It DOES NOT show the free space of your unmounted /dev/sda6.

So you’re actually comparing apples and oranges here.

df can only show the free space on mounted partitions.
From “man df”:

df displays the amount of disk space available on the file system containing each file name argument.

This version of df cannot show the space available on unmounted file systems, because on most kinds of systems doing so requires very nonportable intimate knowledge of file system structures.

You are correct, it is not even apples and oranges. It is much worse :shame:

I will replay this.

boven:~ # df /mnt/B/home/
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda6      103079868 71263280  26557396  73% /mnt/B/home
boven:~ #

This is a better example then the rubbish I showed earlier.

But now I encounter a different problem:

boven:~ # tune2fs -l /mnt/B/home
tune2fs 1.42.8 (20-Jun-2013)
tune2fs: Attempt to read block from filesystem resulted in short read while trying to open /mnt/B/home
Couldn't find valid filesystem superblock.
boven:~ #

And that is also true for e.g. the root file system.
What is wrong with tune2fs?

Maybe I should prove that these are ext4:

boven:~ # mount | grep sda
/dev/sda2 on / type ext4 (rw,relatime,data=ordered)
/dev/sda3 on /home type ext4 (rw,relatime,data=ordered)
/dev/sda5 on /mnt/B type ext4 (rw,relatime,data=ordered)
/dev/sda6 on /mnt/B/home type ext4 (rw,relatime,data=ordered)
boven:~ # 

tune2fs needs the device file as parameter (it would also work with an image file of a partition), as it accesses the blocks of the partition directly.
It doesn’t work to pass the mountpoint. As the error message says, it couldn’t read the filesystem superblock from /mnt/B/home because it is a directory, no file. You can’t read data from a directory.

So use “tune2fs -l /dev/sda6” and it should work.

Eh, gentleman…

Regarding this, any ideas?

It could indeed be the 5% free space that are reserved to root.

You called “df” as user:

user@linux-loyv:~> df -h /dev/sda6

Filesystem      Size  Used    Available   Use% Mounted in

/dev/sda6        20G   12G       7.5G        61%   /


5% from 20G would be 1G, so root (i.e. YaST, which is started as root) would see 1G more free space, so 8.5G.
The rest of the difference might be due to rounding errors/differences.
I.e. is the size exactly 20GiB? (or maybe 19.9 f.e.?) Are exactly 7.5GiB free for the user?

Maybe there even have been files written/deleted on the partition between the two checks (think of /tmp, /var/tmp, /log).

If I compare here (reiserfs with no space reserved for root), YaST says 5.4Gib of 74.5 GiB free, whereas df sees 5.5G from 75G (74.5 rounded up obviously).