2
$ sudo du -h -d 0 home/
309G    home/

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/sda4       550G  309G  214G  60% /home
...

System Monitor on Ubuntu shows the used space on /home is 331.1 GB

enter image description here

Do the different ways measure the same thing?

How differently do they make the measurements?

Thanks.

terdon
  • 242,166
Tim
  • 101,790

2 Answers2

1

It is two different units. The larger number is in gigabytes. 1 gigabyte = 1 billion bytes. The smaller number is in gibibytes. 1 gibibyte = 1,073,741,824 bytes = 2^30 bytes

Mark
  • 39
1

It's the same measurement. 309 Gb is the size specified in powers of 2 (the ugly-named Gibibyte), while 331 Gb is the size specified in powers of 10 according to the SI (Gigabyte).

309 Gb (in powers of 2) * 1024 * 1024 * 1024 = 331786223616 bytes i.e. 331 Gb (in powers of 10).

As pointed out by @don_crissti, df -h prints values in binary powers. If you had run df -H, which uses decimal powers instead, it would have printed 331 Gb of used space.

For more information, see https://en.wikipedia.org/wiki/Binary_prefix .

dr_
  • 29,602