- dotTech - http://dottech.org -

[dotTech Explains] What is the difference between “size” and “size on disk”?

Posted By Ashraf On December 16, 2011 @ 1:50 AM In Linux,Mac OS X,Tips 'n Tricks,Windows | 22 Comments

[1]Ever look at a file or folder and wonder why the heck the “size” and “size on disk” are different? Yeah, me too. Until recently I had no idea why these two are different and just brushed it off as some technical mumbo jumbo. Ignorance may, at times, be bliss; but for the purposes of bettering my inner geek I decided it is time to learn exactly what these two are and why they are different. So I did and now it is time to share the wealth.

What Is “Size”?

The value labeled as “size” is the actual, literal size of the file(s)/folder(s) you have selected. So if dotTech.jpg is listed as a size of 1.25 MB, it is literally 1.25 MB large. If I were to download dotTech.jpg, I would be downloading 1.25 MB worth of data.

What Is “Size On Disk”?

“Size on disk” is the amount of disk space that the file(s)/folder(s) you have selected uses. So while dotTech.jpg may be 1.25 MB, it takes up – for example – 1.30 MB space on the hard drive.

Oh But Why Must They Be Different?

The answer comes down to file systems. Most (all?) file systems store data in clusters. Clusters are blocks of area on the hard drive. Data is stored in these clusters. 1 KB of data in a cluster is enough to reserve that whole cluster for the file in question, even if that cluster isn’t fully used by the file. Thus that difference between the total size of the last cluster used by a file and the total amount of the data stored in that cluster is what results in the difference between size and size on disk. Confused? Let’s look at an example.

Let’s say you have a 10.5 MB file. The “size” of the file is 10.5 MB. Now let’s say the file is stored on a disk that uses clusters of 1 MB. That means the 10.5 MB file needs 11 clusters of space to be fully stored (because 10.5 MB of data cannot be stored in 10 MB of clusters – it needs 11). 11 clusters equals 11 MB. Thus, since that last .5 MB of data occupies a 1 MB cluster, the “size on disk” for the file is 11 MB.

Is This A Trick To Make Us Buy Larger Hard Drives?

Yes. No. Maybe. I don’t know. Juicy gossip avoids my inbox. However, being the ultra rational logic wise man I am, I will go out on a limb and say, no. There is technical justification behind using data clusters. Trust me when I say very smart people have developed our digital world. They know what they are doing. And if they don’t know what they are doing, I don’t want to hear about it. Remember ignorance is bliss.

Do I Need To Lose Sleep Over This?

No. Heck, you don’t even need to know this difference exists. It really makes no difference in your life, assuming you are a normal person and not a programmer. (See what I did there?) Knowing the difference between “size” and “size on disk” is purely for self-knowledge purposes; and for being able to sound smart in front of your parents.

But What About When I Move Files From Drive To Drive?

What about it? The “size” of a file is the literal size of the file; that is the amount of data you move when moving files. (You are not moving clusters.) The available space on a drive is the amount of data – in clusters – that is available. As long as the size of a file is smaller than the available space, you are good to go — there will be enough clusters to accommodate that pron you are hiding the file(s) you are moving.

So Why Post About This?

Because I can.

Feel free to discuss in the comments [2] below. Flame on.

[via Google [3]]


Article printed from dotTech: http://dottech.org

URL to article: http://dottech.org/25247/dottech-explains-what-is-the-difference-between-size-and-size-on-disk/

URLs in this post:

[1] Image: http://dottech.org/wp-content/uploads/2011/12/2011-12-16_020938.png

[2] comments: #comments

[3] Google: http://lmgtfy.com/?q=size+vs+size+on+disk

© 2008-2012 dotTech.org | All content is the property of its rightful owner.