I have a 3TB HDD. In the properties screen of the HDD, it says that I have used 471.4GB, but when I select all the files in nautilus, it says that 321.0GB is selected. If I only have 321.0GB of files in the HDD, why is it using 471.4GB?
The HDD's partitioning is using GUID and file system being used in EXT4. When I select the HDD using Disk Utility app, I get a warning saying:
WARNING: The partition is misaligned by 3072 bytes.
This may result in very poor performance. Repartitioning is suggested.
Has that got anything to do with the missing 150.4GB?
Files on disk have two sizes: the "apparent size" and the "size on disk". Several reasons can cause a large discrepancy:
I would suggest to use a disk usage tool known to be capable of listing both sizes to see if this is the issue. Try
ncdu
in a terminal and use a to toggle between actual and disk usage.A short demo on internal fragmentation due to a 4KiB block size filesystem using
du
:This means that this 10-byte file is 4086 bytes bigger on disk than it would appear in a listing and is suffering from internal fragmentation.
A short demo on hard links and disk usage shown wrong when listing files (
ls
in this case):This happens because the total disk usage is never equal to the sum of all files there (which is what Nautilius shows once you select all files).
The reason for this is that the file systems themselves tend to occupy some space on the partition. Most likely, if you wiped out all data you store on that HDD, disk usage would be about 150GB. That space is reserved for the file system - it is required, as the file system need to store the data about files somewhere. ext4 pre-allocates this overhead space before any files are created, as opposed to - for example - ext3, where that space grows as more files are added to the partition.
If you consider these 150GB as a problem, please notice that it's just 5% of your total HDD size. If you would need more than 95% on you hard drive, you probably need to buy a larger one, instead of worrying about these 150GB that are out of your reach.
Also, please keep in your mind that in case of ext4 this space is not wasted. Data fragmentation is not a problem here, but the cost of this advantage is that extra occupied space. There are ways to decrease it and to force ext4 to use much less of this space, but that's not reccomended, as - because of fragmentation chances and other optimisations that won't be able to happen - this will very likely result in your machine working much slower, as data access won't be this smooth.