What is the difference between “Size” and “Size on disk?”

Looking at the properties for a Windows file I get two attributes, “Size” and “Size on disk,” and "Size on disk" is always larger.

What do these two metrics mean?


Solution 1:

Size is the actual size of the file in bytes.

Size on disk is the actual amount of space being taken up on the disk. They differ because the disk is divided into tracks and sectors, and can allocate blocks of discrete size.

For a more detailed explanation, see this text which I copied from another site:

We know that a disk is made up of Tracks and Sectors. In Windows that means the OS allocates space for files in "clusters" or "allocation units".

The size of a cluster can vary, but typical ranges are from 512 bytes to 32K or more. For example, on my C:\ drive, the allocation unit is 4096 bytes. This means that Windows will allocate 4096 bytes for any file or portion of a file that is from 1 to 4096 bytes in length.

If I have a file that is 17KB (kilo bytes), then the Size on disk would be 20.48 KB (or 20480 bytes). The calculation would be 4096 (1 allocation unit) x 5 = 20480 bytes. It takes 5 allocation units to hold a 17KB file.

Another example would be if I have a file that is 2000 bytes in size. The file size on disk would be 4096 bytes. The reason is, because even though the entire file can fit inside one allocation unit, it still takes up 4096 of space (one allocation unit) on disk (only one file can use an allocation unit and cannot be shared with other files).

So the size on disk is the space of all those sectors in which the file is saved. That means,usually, the size on disk is always greater than the actual size.

So the actual size of a file(s) or folder(s) should always be taken from the Size value when viewing the properties window.

Source: What's The Difference Between Size And Size On Disk In Windows Folder Properties.

Solution 2:

It has to do with the allocation unit sizes used on your disk when it was first formatted.

Imagine you have two 2 x 10 gallon gas cans in your car. Each gas can is an allocation unit. You need to get 12 Gallons of gas, so you need to use both cans. Basically using 20 Gallons of allocated space - but only filling 12 gallons.

Here is the default size for Windows XP

 Drive size   
 (logical volume)             Cluster size          Sectors   
 ----------------------------------------------------------
 512 MB or less               512 bytes             1
 513 MB - 1,024 MB (1 GB)     1,024 bytes (1 KB)    2 
 1,025 MB - 2,048 MB (2 GB)   2,048 bytes (2 KB)    4
 2,049 MB and larger          4,096 bytes (4 KB)    8

If you think of the Cluster size as each of your gas cans: Holding 4KB of "gas" each. But your file is 2KB then the fills size is 2K, but size on disk is 4KB