1

I keep backups at two, 1.5 GB external hard drives which were both, up until recently, formatted to ntfs. The two hold identical copies of my files and folders. Recently I decided to change to ext4, so I reformatted one of the hard-drives and copied (rsync) everything there. To my biggest surprise, I had approximately 100 GB less free space on the new ext4 drive, so I went to investigate the cause.

I checked the free space on both drives but every single application/tool I used showed me a completely different amount.

For the ext4 drive:

  • df which gave me 196 GB free space,
  • Nautilus gave me 210 GB free space,
  • Disks gave me 285 GB free space,
  • Filelight gave me 265,4 GB free space and
  • GParted gave me 265,42 GB free space.

So the free space ranges from 196 GB to 285 GB, which is almost 100 GB difference!!

For the ntfs drive (which holds an identical copy of the other drive):

  • df which gave me 284 GB free space,
  • Nautilus gave me 304,9 GB free space,
  • Disks gave me 305 GB free space,
  • Filelight gave me 284 GB free space and
  • GParted gave me 284 GB free space.

For this hard drive the free space was measured more consistently, "only" had a 20 GB range.

So my questions: Which is the real one? Which one should I really believe? Why they report such different space sizes? Especially to such a native format for linux (ext4)? And why there is such a significant difference between the free spaces on the two systems? I expected to have more free space on the ext4 drive.

Thanks for any insight!

1
  • To start with, which Linux distro have you installed (Ubuntu server, Ubuntu desktop, Kubuntu, Lubuntu, Xubuntu, Ubuntu MATE, Mint, et al.), & which release number? Different releases have different tools for us to recommend. Please click edit & add that to your question, so all facts we need are in the question. Please don't use Add Comment, since that's our one-way channel to you. All facts about your PC should go in the Question with edit as this is a Q&A site, not a general forum, so things work differently here.
    – K7AAY
    May 26 '20 at 17:09
1

File size and consequently free space are not calculated consistently between applications.

This is due to the nature of file systems. Data is stored in blocks on the drive. A typical block size is 4096, meaning it can contain up to 4096 bytes of data per block.

If you have a file that contains only 1 byte of data, it actually will take up 4096 bytes of space on your hard drive.

Similarly, if you have a file that contains 4097 bytes of data, it will reserve two blocks, or 8192 bytes of storage.

If you have an application that is counting the size of data in each file, it will be a smaller value than an application that counts the sum of all used blocks.

When calculating file size, many applications use a number of "tricks" to estimate or cache file sizes so your system does not actually need to read the entire contents of your hard drive. This can also cause differences between applications.

For another example, you can see this answer on why ls -l outputs a different size than ls -s

0

Some additional reasons why free/used file size is reported differently by different applications:

  • Some report the size in "Gigabytes", while others report in "Gibibytes"
  • Ext4 in particular reserves some space on the filesystem which is not available to the user - 5% by default if it is not specified by the user on formatting. Some applications may include that in the total size of the drive, some may not. But that's the reason ext4 drives often appear smaller than expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.