Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 695  / 3 Years ago, thu, may 20, 2021, 2:38:04

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!


More From » nautilus

 Answers
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


[#3363] Saturday, May 22, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
etzelmortg

Total Points: 430
Total Questions: 105
Total Answers: 106

Location: Suriname
Member since Sun, Jun 13, 2021
3 Years ago
;