When I create a .txt file with just one character, I found that the explorer check the size in 1KB but when I check in properties they said 1bytes and size from disk 4KB, so wich is the real size on disk? thank you.
1 Answer
so wich is the real size on disk?
That depends on what you actually want to measure.
In terms of actual data, the filesize is one byte (that's all that has been written and can be read back).
In terms of storage space that the file occupies, then the size is determined by the allocation unit of the filesystem. For NTFS on Windows, the typical or default size of a cluster is 4096 bytes. (Note that the cluster or allocation size, a software attribute, is always a multiple of the device's sector size, which is a hardware attribute.)
Explorer apparently rounds-up the filesize to the next KB.
The file property is reporting the actual filesize of 1 byte.
The size on disk indicates that the cluster size (for that filesystem) is 4096 bytes. (The allocated but unused 4095 bytes in that cluster are referred to as slack space.)
-
And because the allocation unit is configurable, the "size on disk" can be made to vary even between identical disk hardware– YorikCommented Jan 12, 2016 at 22:04