Windows 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?

Cluster Slack Space

You cannot access each individual byte on a storage medium separately. To do so would be terribly inefficient because the system needs some way of keeping track of which ones are used and which are free (i.e., a list), so doing so for each byte separately would create too much overheard (for each individual byte, i.e. 1-to-1, the list would be as big as the medium itself!)

Instead, the medium is broken up into chunks, blocks, units, groups, whatever you want to call them (the technical term is clusters), each of which contains a—consistent—number of bytes (you can usually specify the size of the clusters since different uses call for different sizes to reduce waste).

When a file is saved to disk, the size of the file is divided by the cluster size and rounded up if needed. This means that unless the filesize is exactly divisible by the cluster size, some of the cluster ends up being unused and thus wasted.

When you view the properties for a file, you see the true size of the file as well as the size it takes up on disk which includes any “slack”, that is, the “cluster tips” that are unused. This is usually not much per-file and the size on disk will usually be almost equal to the actual size, but when you add up the wasted space from all the thousands of files on a drive, they can add up. Therefore, when you view the size of a large folder, especially one with many tiny files that are smaller than a cluster, the size on disk (i.e., the amount of disk space marked as used) can end up being significantly larger than the actual size (i.e., the amount space the files actual require).

In a case like above, what you can try is to reduce the cluster size so that each file wastes less space. Generally, a drive with mostly lost of little files should use the smallest cluster size possible (to reduce waste) and a drive with mostly large files should use the largest cluster size possible (this way the bookkeeping structures end up being smaller).

Even at a lower level, if each cluster is only a single sector, unless a file is an exact multiple of the size of the sectors on the drive (usually 512 bytes traditionally, now often 4,096 with Advanced Format disks), then there will still be unused space between the end of the file and the end of the sector.

Compression

Another scenario where you might see a difference between the actual file size and size on disk is with compression. When a drive is compressed (e.g., using DriveSpace, NTFS compression, etc.) then there will be a difference between the size of the actual file (which needs to be know), and the actual size that the file occupies (i.e., uses or “takes up”) on the disk.

Shortcuts and Hardlinks

Yet another scenario that could result in a difference is with hardlinks. With file-systems that support hardlinks, when a duplicate file is created, instead of making a whole new file that takes up space for itself, the file-system creates a shortcut to the file so that both (or all three, etc.) copies point to the same physical file on disk. Therefore, when there are two files pointing to the same data, they each have the same size, but take up only slightly more than the space to store a single copy.

Last updated 29 Jul, 2022

size on disk vs. size

Many people claim that there is a significant difference between size vs size on disk, but why does this difference exist?

When people look at the properties of a folder, file, or drive they note that properties size and size on the disk are not the same and they get confused. When you see the size of the file on the properties page, it shows the actual file size.

On the other hand, the size on the disk indicates the total number of bytes occupied by a file on a hard drive. Mostly, both these values are very close, you will notice this difference after opening the properties of a folder or a file.

Here we explain why this difference exists and whether this should be a concern.

Acronis Cyber Protect

Size vs Size on Disk

You can find out huge differences after understanding the central concept of both these terms. So, let’s explain both these terms individually.

What is meant by file size?

When you click on the properties of a folder or file, you get the value of bytes and size. This value is an indicator of the actual bytes and size in the file. The file size is used for the measurement of the data present in the storage device. This size is presented in the form of a byte.

See also: Data capacities – smallest to largest units of information

What is the meaning of file size on disk?

The size on the disk is the indicator of how much space a file occupies on the hard disk drive. When a file is stored in a modern storage device, it usually consumes slightly more storage than the actual file. That’s the reason why you see the difference between size vs size on disk. Check the screenshot below, and it will clear your basic concepts.

Size and Size on Disk

Why is there a difference between Size and Size on Disk

Now the question that comes in our minds is what factors affect this file size on disk. Obviously, it depends on how your file system stores file on the storage drive. A file uses different addresses and to reduce this file system treats the number of files as a single cluster. The capacity of file size not only decided by the maximum size of a file, but it is also determined by the number of bits reserved for the information of file size. For example, the maximum file size supported by the FAT32 file system is 4,294,967,295 bytes.

Usually, in the NFTS file system, the cluster sizes range from 512 Bytes to 64 KB. It doesn’t matter how small the actual file size is because when a file is written on the hard drive, it occupies a discrete number of clusters. For example, the size of a file is 1 KB, but you save it in a file system of 2 KB clusters, it will take up 2 KB size on disk.

Similarly, when you save the 1 KB file in the file system of 32 KB clusters, it will actually take up 32 KB on the disk. Now, it’s clear that the size of a file on disk will be bigger than the actual file size. Sometimes you may get surprised as well, but it will be an exception.

For example, you may encounter a situation is which size on disk will be smaller or equal to actual file size. Remember, it will happen only when you are using the automatic compression feature that you get from your operating system. This feature compresses the file so the size on the disk will be smaller than the actual file size.

There isn’t a vast difference between the size and size on disk, however many users have claimed that a significant difference between the actual file size and size on disk exists. So, let’s try to find out the reason why there is a massive difference between the two.

What are the reasons for a large difference between Size and Size on Disk?

A hard disk consists of sectors and tracks. When you are a Windows PC user, the operating system allocates disk space for cluster units. The file system of your storage drive set different cluster sizes that affect the size on disk.  When it comes to the considerable difference between size vs size on disk, you can check if there are lots of small files inside the folder and cluster size is large.

This difference will increase with the increase in the number of files because each file will waste the storage space of the drive. This size of wasted drive space keeps on adding and reaches a certain level; at that stage, the size on disk will be much larger than the actual size.

These situations occur when there are lots of small files in a folder. Along with the size on disk, it also depends on the cluster size of your file system. When you set a larger cluster size for disk, and you have a large number of files, more space will be wasted. Usually, the typical cluster size of a drive is 4 KB. For large files like games and 3D movies, you can choose 32 or 64 KB cluster size.

Acronis Cyber Protect

How to decrease the difference between Size and Size on Disk?

You can make the best use of storage devices when you manage the cluster size effectively. If you want to narrow down this vast difference, change the cluster size of the disk. You can use Windows built-in tools like Diskpart and Disk Management to change the cluster or allocation unit size. These tools can help significantly narrow down the differences between sizes.

People get confused when they see a difference in size and size on disk. It is because of the large number of small files and cluster size. Mostly the size on disk is much greater than the actual file size. Moreover, in some exceptions, this size can be less than the actual file size if your operating system uses the auto compression system. You can do this by using built-in tools mentioned-above. These tools create a partition and help reduce the allocation units and cluster sizes significantly.

You may find the difference between size and size on disk. Do you know why? How to narrow the size vs size on disk huge difference? If you are also searching for the answers, this post of MiniTool is your best choice.

Most of the time, the values between size and size on disk are very close. However, a great many people still notice there is a big difference between size and size on disk when opening the properties of a file or folder.

the big difference between size and size on disk

Some people reported this question on forums or communities. They want to know why there is such a huge difference between size and size on disk. For example, a user from SuperUser reported that size on disk is always lager than size.

I was looking on properties of a file and saw two little bit confusing things that make me confused. What does mean «Size» and «Size on disk» for a file? I’ve read a post just like this that has been solved but I didn’t get my answer. Please clarify me.

Size VS Size on Disk

To figure out the size vs size on disk huge difference, you need to understand their own concept. So, this section will explain the definition of size and size on disk separately.

What Does File Size Mean?

When opening the properties of a file, folder, or drive, you will find the values of the size and bytes. The values indicate the actual size and the actual number of bytes in the file. The file size measures how much data a file contains on the storage device. It is presented in the form of the byte. Have a look at the screenshot below. The numbers inside the red box are the actual file size.

the actual size of the file

What Does File Size on Disk Mean?

The size on disk indicates the number of bytes that the file actually takes up on the hard disk drive. When a file is written to the file system of a modern storage device, it may take up slightly more disk space than the actual file size. That is why you find there is a difference between size and size on disk.

size on disk

What Affects the File Size on Disk

So, what affects the file size on disk? In fact, it depends on the way that your file system stores the file on the hard drive. To reduce the number of addresses that are being used by the files, the file system will treat a number of bytes as a single cluster.

The maximum file size that a file system can support is not only decided by the capacity of the file system, but also by the number of bits reserved for the file size information. For example, the maximum file size that FAT32 file system supports is 4,294,967,295 bytes.

Usually, common cluster sizes can range from 512 Bytes to 64 KB (NTFS file system). No matter how small each actual file size, the file that is written to the hard drive will occupy a discrete number of clusters. For instance, if you save a 1 KB file in a file system with 2 KB clusters, the size on disk will take up 2 KB.

If you save the 1 KB file in a file system with 32KB clusters, the file will take up 32 KB disk space. The amount of wasted space for each file will not surpass the cluster size that you set for a file system.

Now, you may have known why the size on disk is always slightly bigger than the actual size of a file. Well, you may encounter some exceptions as well. The size on disk can be the same as or smaller than the actual size. It may occur when you use the automatic file compression feature provided by your operating system. Since the file is compressed, the size on disk would often be smaller substantially.

Generally speaking, there is no big difference between the size on disk vs size. However, many users reported that there is a huge difference between size and size on disk. What happened here? Please keep reading on the following part.

Why There Is Big Difference Between Size VS Size on Disk

As you might know, a hard disk is made up of the Tracks and Sectors. When using a Windows PC, the operating system will allocate disk space for each file in clusters or allocation units. The file system of your drive can set different cluster size, which affects the size on disk.

When it comes to the size on disk vs size huge difference, you can check if there are lots of small files inside the folder and the cluster size is relatively large. If it is, the discrepancy will be much bigger because every single file will waste drive space. When the wasted drive space adds up to a certain level, it is very likely that the size on disk is greatly larger than the actual size.

So, this situation often occurs when there are a large number of small files. Besides, the size on disk also depends on the cluster size of your file system. Here we take the 32 KB cluster size (FAT 32 file system) for example. Assuming that there are 50000 files inside your disk. You can calculate the following result:

The files will take about 1.6 GB disk space (the minimum space: 50000*32). Then the disk space that every single file takes is always a multiple of the allocation unit size. If each file size is 2 KB on average, you would get about 100 MB total. But the disk size will also waste 15 times (30 KB per file) of actual file size on average because of the allocation size, which can consume much larger size on disk than actual size.

Generally speaking, the larger the allocation unit size (cluster size) you set for disk, the more disk space will be wasted especially if you have a large number of small files. Usually, 4 KB is a common cluster size of a drive today. Well, you can choose 32 or 64 KB cluster size that is widely used for large files like games, 3D movies, etc.

Right now, you may have a deep understanding of size vs. size on disk. More importantly, what should you do to narrow the size vs size on disk huge difference? Please keep reading the following text.

How to Narrow the Size VS Size on Disk Huge Difference

To make full use of your storage devices, you need to manage the cluster size effectively. Changing the cluster size of the disk can help you narrow the huge difference between size on disk vs size.

Here you can utilize the Windows built-in tools Disk Management and Diskpart to change the allocation unit size. Both of the 2 tools require you to format the specific partition. Well, you can choose MiniTool Partition Wizard that can help you change cluster size without data loss.

Method 1. Use Disk Management

When it comes to changing cluster size, Disk Management is a commonly used tool. You can follow this full guide to change the cluster size.

Step 1. Right-click the Start button and select Disk Management from the context menu.

select Disk Management

Step 2. Right-click the partition that you encounter the size vs size on disk huge difference issue and select Format.

Step 3. In the pop-up window, select the allocation unit size from the drop-down menu based on your demands and click OK to continue.

choose an allocation unit size

Step 4. Then, you will receive a warning message stating that all the data on the partition will be deleted. If there are important data on the drive, please back up them. Click on the OK button to confirm.

click on OK to confirm

Method 2. Use Diskpart

You can run Diskpart to change the cluster size of your drive. This operation also requires you to format the partition, so please make a backup in advance. Now, follow the steps below.

Step 1. Press Win + R keys to open the Run dialog box, and then type diskpart in the box and hit Enter.

Step 2. In the pop-up window, type the following commands and hit Enter after each.

  • list disk
  • select disk * (replace * with the number of the target disk or partition that you want to change cluster size)
  • list partition
  • select partition *
  • format fs=ntfs unit=4k

Tip: Here you can choose other allocation unit sizes based on your needs.

change the allocation unit size

Now, you will find the cluster size has been changed successfully. In addition to the 2 tools, any better choice to change cluster size without data loss? Yes, there is! Please keep reading.

Method 3. Use MiniTool Partition Wizard

MiniTool Partition Wizard Pro Ultimate Edition can help you change cluster size without data loss. It is a powerful partition management tool that boasts many other practical features such as convert MBR to GPT without data loss, upgrade hard drive, resize partition, etc.

It is very simple to operate with just a few clicks.

Buy Now

Step 1. Install this program to your computer and launch it to get the main interface.

Step 2. Select the partition that comes with the issue and click on the Change Cluster Size feature from the left pane.

Step 3. Select a suitable cluster size from the drop-down menu and click on the Yes button to back the main interface.

Step 4. Click on Apply to execute this operation.

click on Apply

I found there is a simply massive disparity between the «size» and the «size on disk» reported by the folder/file properties when browsing the share in Windows. What’s the difference between size and size on disk? Why there’s a big difference? I got these answers from this post. Click to Tweet

Have A Try Now!

Size vs. size on disk what’s the difference between them? Why there is so big difference between size and size on disk? Have you figured these questions out? If you have any questions, please send us an e-mail via [email protected]We also appreciate any ideas left in the comment area.

Size VS Size on Disk FAQ

How do I reduce the size of a disk?

  1. Right-click the Start button and select Disk Management from the context menu.
  2. Right-click the volume that you want to reduce the size and select Shrink Volume.
  3. Enter the amount of disk space in the box and click on Shrink.

What cluster size should I use for NTFS?

Usually, the hard drive cluster size will be set to the default 4096 bytes if you are a standard used by Microsoft definition. Besides, the allocation unit size is the block size on the hard drive when formatting NTFS. If you have lots of small files, it would be better to keep the cluster size small so that your hard drive space won’t be wasted.

How do I check disk allocation unit size?

  1. Press Win + E keys to open the File Explorer and click on This PC from the left pane.
  2. Right-click the drive that you want to check and select Format.
  3. In the Format window, you can check the allocation unit size of your disk.

How do I format a large USB to FAT32?

  1. Connect the USB to your computer and then open the Disk Management
  2. Right-click your USB drive and select Format from the context menu.
  3. Select FAT32 from the drop-down menu of the file system and click on OK. If your USB drive holds more than 32GB capacity, you can use a professional tool like MiniTool Partition Wizard to format a large USB drive.

При просмотре свойств любого файла вы можете видеть два параметра, указывающих его вес – «Размер» и «На диске». И эти показатели будут разными. И, наверняка, вам было интересно, почему они разные, чем они отличаются, и каков действительный вес просматриваемого файла. В данной статье я вам это доступно объясню.

Свойства файла «Размер» и «На диске»: в чём разница и каков реальный вес файла«Размер» и «На диске» — в чём разница

Итак, если кликнуть правой кнопкой на файл и выбрать пункт «Свойства», то мы видим окно, в котором можем посмотреть вес данного файла. Они указываются в строках «Размер» и «На диске». Эти параметры разные.

Свойства файла «Размер» и «На диске»: в чём разница и каков реальный вес файла

Почему они разные и какой реальный вес файла? Чтобы это понять, отойдём от компьютерной темы и обратимся к жизненному примеру.

Представьте себе, что у вас есть 3 бочки по 10 литров каждая. И вам необходимо сохранить в них 12 литров пива и 5 литра томатного сока. Вы заливаете пиво в первую бочку, туда пометилось только 10 литров. Оставшиеся 2 литра пива вы заливаете во вторую бочку. 5 литров томатного сока можно пометить в последнюю третью бочку.

В результате у вас получилась одна полная почка пива, одна бочка пива заполнена лишь на 2 литра, и ещё одна бочка томатного сока, заполнена только наполовину.

О них сейчас говорят все: SMM продвижение и маркетинг в социальных сетях. Но не все в курсе, как это реально работает. Блог pricesmm.com даёт не пустую теорию, как развивать интернет маркетинг в социальных сетях, а подкрепляет слова делом. Вы получите практичные советы, узнаете секреты лидеров, а также как и где отыскать эффективный СММ сервис. С такой поддержкой будет легко добиться успеха.

Вернёмся к компьютерам. На жёстком диске с файловой системой NTFS (на компьютерах чаще всего именно такая файловая система) существуют ячейки размером по 4 Кб. Это как наши бочки по 10 литров. Файлы, сохраняемые на жёстком диске, будут заливаться в эти «бочки» по 4 Кб. Таким образом, если мы сохраняем на компьютере файл размером, допустим, в 8 Кб, он займёт 2 ячейки памяти (2 бочки). Если мы сохраняем файл размером в 5 Кб, он тоже замёт 2 ячейки (4 Кб в одну и 1 Кб в другую). Файлы, размером менее 4 Кб занимают одну ячейку.

Продолжаем вести линию от бочек с пивом и томатным соком. Когда вы залили 10 литров пива в одну бочку, а оставшиеся 2 литра в другую, вы не стали наполнять эту не до конца залитую бочку пива томатным соком (ведь нельзя же смешивать пиво и сок). Вы в этом случае использовали другую, новую бочку.

Так и с ячейками памяти. Если файл размером 5 Кб, занимает 2 ячейки (4 Кб в одной и 1 Кб в другой), то эта не заполнена до конца ячейка, не займётся другим файлом. Другой файл будет записываться в следующую свободную ячейку.

И теперь вернёмся к самому началу – параметрам «Размер» и «На диске». «Размер» указывает, сколько есть реального объёма файла, то есть, сколько пива было в действительности. А «На диске» показывает, сколько этот файл занял места на диске, то есть, сколько объёма бочек ушло на сохранения имеющегося пива.

Параметр «Размер» является реальным размером файла. Файл будет таким, на какой носитель вы бы его не переместили. А «На диске» указывает, сколько места он занимает на жёстком диске. Он может зависеть от файловой системы носителя. «Размер» и «На диске» всегда близки, но первый меньше второго.

Для закрепления знаний обратимся к скриншотам с примерами. На первом скриншоте мы видим параметры «Размер» и «На диске» равные 10 байт и 4 Кб, соответственно.

Свойства файла «Размер» и «На диске»: в чём разница и каков реальный вес файла

Это значит, что файл реально всего весит 10 байт, на жёстком диске занимает одну целую ячейку – 4 Кб. В этой ячейке другие файлы не будут записаны.

На втором скриншоте параметры «Размер» и «На диске» равны 5.99 Кб и 8 Кб, соответственно.

Свойства файла «Размер» и «На диске»: в чём разница и каков реальный вес файла

Это значит, что реальный размер файла 5,99 Кб, а на диске он занимает две ячейки памяти, то есть 8 Кб. При этом одна из них заполнена полностью на 4 Кб, а вторая частично – на 1,99 Кб. И другой файл в эту, не до конца заполненную, ячейку памяти не запишется.

В большинстве случаев значения «Размер» и «Размер на диске» будут очень близки к совпадению при проверке размера папки или файла, но что, если между ними существует огромное расхождение? Сегодняшняя публикация SuperUser Q&A дает ответ на эту запутанную проблему.


Сегодняшняя сессия вопросов и ответов проходит благодаря SuperUser — подразделению Stack Exchange, группы веб-сайтов вопросов и ответов, управляемой сообществом.

Читатель SuperUser thelastblack хочет знать, почему существует такая огромная разница между «размером» и «размером на диске» для папки на SD-карте его телефона:

Глядя на снимок экрана, определенно существует огромное несоответствие между «Размером» и «Размером на диске», так что же здесь произошло, чтобы вызвать это?


Я предполагаю, что вы используете здесь файловую систему FAT / FAT32, поскольку вы упомянули, что это SD-карта. NTFS и exFAT ведут себя одинаково в отношении единиц распределения. Другие файловые системы могут отличаться, но они все равно не поддерживаются в Windows.

Если у вас много маленьких файлов, это, безусловно, возможно. Учти это:

  • 50 000 файлов
  • Размер кластера 32 КБ (единицы распределения), что является максимальным для FAT32.

Хорошо, теперь

минимум

занятое пространство составляет 50 000 * 32 000 = 1,6 ГБ (с использованием префиксов SI, а не двоичного кода, для упрощения математики). Пространство, которое каждый файл занимает на диске, всегда кратно размеру единицы распределения — и здесь мы предполагаем, что каждый файл на самом деле достаточно мал, чтобы уместиться в одной единице, а некоторое (потраченное впустую) пространство осталось.

Если каждый файл имеет в среднем 2 КБ, вы получите около 100 МБ, но вы также потеряете в среднем 15 раз (30 КБ на файл) из-за размера единицы распределения.


Подробное объяснение

Почему это происходит? Ну, файловая система FAT32 должна отслеживать, где хранится каждый файл. Если бы он вел список из каждого байта, таблица (например, адресная книга) увеличивалась бы с той же скоростью, что и данные, и занимала бы много места. Поэтому они используют «единицы распределения», также известные как «размер кластера». Том разделен на эти единицы распределения, и что касается файловой системы, они не могут быть подразделены — это самые маленькие блоки, которые он может адресовать. Как и у вас есть номер дома, но почтальону все равно, сколько у вас спален и кто в них живет.

Так что же произойдет, если у вас очень маленький файл? Что ж, файловой системе все равно, имеет ли файл размер 0 КБ, 2 КБ или даже 15 КБ, она предоставит ему как можно меньше места — в приведенном выше примере это 32 КБ. Ваш файл использует только небольшую часть этого пространства, а остальное в основном тратится впустую, но все равно принадлежит файлу — так же, как спальня, которую вы оставляете незанятой.

Почему существуют разные размеры единиц распределения? Что ж, это становится компромиссом между наличием большего стола (адресная книга, например, говоря, что Джон владеет домом на 123 Fake Street, 124 Fake Street, 666 Satan Lane и т. Д.) Или большим количеством потраченного впустую места в каждой квартире (доме) . Если у вас есть файлы большего размера, имеет смысл использовать более крупные единицы распределения, потому что файл не получает новую единицу (дом), пока не будут заполнены все остальные. Если у вас много маленьких файлов, что ж, у вас в любом случае будет большая таблица (адресная книга), так что вы можете давать им небольшие единицы (дома).

Большие единицы размещения, как правило, занимают много места, если у вас много маленьких файлов. Обычно нет веских причин превышать 4 КБ для общего использования.


Фрагментация?

Что касается фрагментации, фрагментация не должна тратить впустую пространство таким образом. Большие файлы могут быть фрагментированы, т. Е. Разделены на несколько единиц распределения, но каждая единица должна быть заполнена до начала следующей. Дефрагментация может сэкономить немного места в таблицах распределения, но это не ваша конкретная проблема.


Возможные решения

Как

Gladiator2345 предложил

, ваш единственный реальный вариант на данный момент — жить с ним или переформатировать с меньшими единицами распределения.

Ваша карта может быть отформатирована в FAT16, которая имеет меньший предел размера таблицы и, следовательно, требует гораздо больших единиц распределения, чтобы адресовать больший том (с верхним пределом 2 ГБ с единицами распределения 32 КБ).

Источник

любезно предоставлено

Braiam

. Если это так, вы все равно сможете безопасно отформатировать как FAT32.

Есть что добавить к объяснению? Отключить звук в комментариях. Хотите узнать больше ответов от других технически подкованных пользователей Stack Exchange?

Ознакомьтесь с полной веткой обсуждения здесь

.

When a file is stored on the hard drive, it tends to occupy a certain number of bytes. This is connoted by the size on disk. On the other hand, size of the file simply means the actual size of a given file that includes solely the data stored within it.

The difference between size and size on disk is that size refers to the real size of a file, size on disk is the measure of the number of bytes the file occupies on the hard disk. People are frequently confused by these two values as they are often different. This difference arises from the seminal dissimilarity in the meaning of each term.

Size vs Size on disk

Comparison Table

Parameters of Comparison Size Size on Disk
Definition Size of a file refers to the actual size of the file. Size on disk refers to the size of the file when stored on the hard disk.
Measurement Size of the file is usually smaller than size on disk. Size on disk is usually larger than the size of the file.
Wasted Space The actual size of the file does not waste space. Size on disk wastes cluster space.
Additional Storage Locales The additional sectors where the same file is stored is not included in the size of a file. The additional sectors where the same file is stored is included in the size on disk.
Compression Cannot reduce the size below the size on disk. Can reduce the size on disk for a given file.

What is Size?

Size refers to the actual size of a given file. File size simply measures the amount of data stored on a particular file. When we click on the file properties icon, it displays two outcomes. One is the actual size of the file and the other is the size of the file on disk.

The actual size of the file is presented in the form of bytes. It connotes the actual byte count of any given file. This value is usually much lesser than the size of the same file on the disk.

The amplification of its bytes count happens due to the storage of the file in clusters on the hard drive. The size of the file is usually rounded up and includes the unused disk space as well. This leads to the bloating of byte counts on the hard drive for the same file.

size

What is Size on Disk?

Size on disk refers to the size of a given file when it is stored on a hard drive. The hard drive uses clusters to store files. This measure of space that the cluster allocation of a file occupies on the hard drive is known as size on disk.

In other words, the byte count of the file on disk is higher than the normal byte count of the same file. One of the most prominent features of size on disk is that it is usually larger than the actual size of the file. The size on disk may be compressed, but it still remains a little over the actual size.

The discrepancy between file size on disk and its actual size happens because if the file size is not divisible by the available clusters or is smaller than the smallest available cluster, there will be empty residual space on that cluster.

Although the file is not occupying the entire cluster, the size on disk shows the file using the whole cluster and hence displays an enhanced bytes count.

size on disk

Main Differences Between Size and Size on Disk

  1. The main difference between size and size on disk is in terms of the definition of each of these terms. The former connotes the actual size of a given file, while the latter stands for the size of the file on the hard disk- measured in terms of the number of bytes it occupies.
  2. The second difference between the two terms can be noted in terms of their discrepancies in measurement. While the actual size of a file may be smaller, the size of the same file on the disk is displayed as significantly larger.
  3. Additionally, the size on disk takes into account all the different sectors where the given file may be saved. This is a reason for its amplified size. Whereas, the actual size of the file does not take into account the additional sectors of the file.
  4. When a file is stored on the disk, it is stored using clusters. This means that if the file size is not wholly divisible by the available clusters, there will be wasted space left in open clusters. Hence size on disk results in a certain amount of wasted space, which is not the case while dealing with the actual size of the file.
  5. Compression may reduce the file size on the disk- lowering it more than the actual file size. Compression does not lower the actual size over the size on disk for the same file.

References

  1. http://www.cse.buffalo.edu/faculty/tkosar/cse710_spring14/papers/gpfs.pdf
  2. https://static.usenix.org/event/fast08/tech/full_papers/zhu/zhu.pdf

Sandeep Bhandari

I am Sandeep Bhandari; I have 20 years of experience in the technology field. I have various technical skills and knowledge in database systems, computer networks, and programming. You can read more about me on my bio page.

folder-logo1 Многих интересует почему в свойствах файла или каталога отображается разница между размером файла и занимаемым местом на диске.

Кликнув на файле или каталоге правой кнопкой «мыши» и выбрав пункт «Свойства» можно увидеть разницу между «Размер» и «На диске». Например в файловом менеджере SpaceFM эта информация представлена как «Общий размер» и «Размер на диске«.

Почему «Размер на диске» больше чем «Общий размер»

Причина в разнице между реальным размером файла и фактически занимаемым местом на жестком диске кроется в размере блока, который автоматически или вручную был выбран при форматировании диска.

Большинство современных файловых систем могут работать с размерами блока от 1 КБ (1024 байта) до 64 КБ (65536 байт). При создании файла для его хранения на диске ему отводится определённое количество блоков.

Например, если в файловой системе, которая отформатирована с размером блока в 4 КБ (4096 байт), создать пустой текстовый файл, то его «Размер» (Общий размер) будет 0 байт, а фактически «На диске» (Размер на диске) он будет занимать 4 КБ (4096 байт).

Другими словами, под хранение файла отводится минимум один блок файловой системы, а если файл не помещается в один блок, то ему отводится ещё один, и так далее пока файл не поместится полностью. Когда файл не помещается в один блок, то в таком случае мы получаем его фрагментацию — т.е. файл разбивается на фрагменты размером в 4 КБ (4096 байт) и помещается в отдельные ячейки (блоки) файловой системы.

Почему «Общий размер» больше чем «Размер на диске»

Бывают также и такие, казалось бы парадоксальные, случаи, когда файловый менеджер может выдать результат в котором «Размер» (Общий размер) окажется больше, чем фактически «На диске» (Размер на диске).

Например «Общий размер:» корневого раздела / 281,0 Г ( 1071898461 байт ), а «Размер на диске:» 274,5 Г ( 2703195136 байт ). Так может произойти, например, из-за использования NTFS сжатия на разделе.

В данном случае так и произошло, ОС Linux, анализировался корневой раздел / в структуре которого в точку /mnt/BACKUP был смонтирован NTFS раздел с размером блока в 64 кб и активированным на нём NTFS сжатием.

Какой размер блока выбирать при форматировании диска

Для операционной системы, включая домашние каталоги пользователей, вполне оптимальным размером является стандартный размер блока в 4 КБ.

А вот для хранения больших мультимедиа (аудио, видео) файлов, минимальный размер каждого из которых всегда больше 1-3 МБ, лучше конечно выделить отдельный раздел и отформатировать его с максимальным размером блока в 64 КБ.

Что касается виртуальных серверов используемых под обычные веб-сайты, то в этом случае возможно будет лучше снизить размер блока до 2, а то и до 1 КБ — ведь от общего числа файлов хорошо оптимизированного сайта может быть около половины файлов не превышающий даже 1 КБ (80, 500, 800 байт).

winlogo.jpgOne of the most confusing things Windows users may come across, is what to believe the actual folders or files sizes are on disk. You probably seen it when right clicking on a folder and selecting Properties, then viewing the Size and Size on disk numbers that are displayed.

As you can see two different size values are being calculated. In reality both values are correct.  But which value is the the actual size of the file or folder you need to know?

That would be the Size value. Here’s why:

Size is the actual size of the file or the folder. So if you were to transfer the file or folder to another drive, CD, DVD or USB drive, this would be the actual size in bytes that is being copied.

Size on disk means the size that is being taken up on the disk (your hard drive). What does that mean?

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.

Am I being presumptuous when I say that sometimes Windows is an extremely confusing operating system?

I’m not referring to the graphical user interface.  Anyone can point and click a mouse; I’m talking about the little things that just don’t seem to make any sense.

One of those little things revolves around the quirkiness of file sizes.

If you right click any file or folder in Windows and go to Properties you’ll see two seemingly contradictory attributes:

  • Size
  • Size on Disk

Sometimes these values match but other times they’re different.

As you can see below, I have a folder called Web which is where I store all my websites.  Windows is showing that the Size is 3.82 GBs but the Size on disk is 3.87 GBs.

Windows 8.1 File Size vs Size on Disk

So which one is it?


Microsoft’s Raymond Chen has a great technical explanation of the size disparity; however, it might be too abstruse for average users.  So I’ll give you the Vonnie translation.

Let’s say you created and saved and empty text file called “Nothingingness.txt”.

Even though there’s nothing in the file and the Size and Size on Disk properties show zero bytes, it still consumes space because Windows has to allocate negligible room for metadata such as:

  • File location
  • Creation Date
  • Permissions
  • The name of the file itself

To understand why there is sometimes a difference between the file size and the file size on disk we need to understand a little bit about the “lay-of-the-land” as it applies to hard drives.

Traditional spinning disk hard drives are segmented into concentric circles called tracks.  If you could visualize this it would look something like a bulls-eye from a dartboard.

A single “slice” of the dartboard “pie” gives you a sector.  It’s basically a way to section the hard drive so you can do something meaningful with the data on it.

A collection of sectors is called a cluster and this is the tiniest amount of disk space that can be used to hold a file. They typically range from 512 bytes to 32KB in size but the important thing to note is that the sizes are estimations and are always rounded up to nearest whole number of clusters.

This means if your hard drive is segmented into 512 byte clusters then any files smaller than 512 bytes will still take up the full 512 bytes on the disk.

To illustrate this point I created a new file and copied all 26 characters of the alphabet 20 times.  Since this is a plain text file with no formatting, spaces or anything like that, the actual size of the file is 520 bytes.

That’s because each ASCII character is exactly 1 byte so… 26 characters in the alphabet multiplied by 20 duplicates equals exactly 520.

Understanding the file size and file size on disk

Easy enough.

But notice that the Size on Disk shows 4,096 bytes.  Where the heck did that number come from?

The 4,096 is my cluster size also called the allocation unit.

This is how you can find your cluster size:

In Windows 8 you can press Windows Key + x + a to open the Command prompt and type:

 chkdsk

(Windows 7 and Vista users can just click the windows icon in the lower left corner of the screen and then type the same command)  .

When the diagnostic finishes, scroll down and look for the little line that reads:

bytes in each allocation unit

That is your cluster size in bytes.

Bytes in each allocation unit

In my example, you can see my cluster size is 4KB.  I just took 4,096 bytes and divided by 1,024 to get the number of bytes per kilobyte.

The computer is just rounding to the nearest factor of the cluster size: 4KB.

Let’s keep doubling the bytes of text in the file to see what that does to the size on disk.

File size on disk 2

520 * 2 = 1040

Alright let’s keep going.

File size on disk 3

1040 * 2 = 2080

Now we’ve almost closed the gap.  I’m going to double the alphabet one more time.

File size on disk 4

2080 * 2 = 4160.

Now since this is larger than the cluster size of 4096, Windows rounds up to the nearest factor of the cluster.

Notice how my Size on Disk value now shows the next multiple of the cluster size.  This is what happens to every file and folder on your computer and it’s why the Size and Size on Disk values sometimes don’t match.

So what’s the real size?

The actual size of the file in bytes is the Size value. In other words, my alphabet file example is exactly 4,160 bytes; therefore, someone would need at least 4,160 bytes of space of storage on their hard drive to view it.

Think of the other value as the amount of space you’ll reclaim by deleting the file.

In other words, if I delete alphabet-160-times.txt I’ll get back 8,192 bytes of hard drive space.  This is because the the smallest unit of data a hard drive can work with is the cluster and my file is consuming two blocks of 4,096.

I hope that makes sense.

This whole size vs size on disk thing is pretty confusing but it really all comes down to clusters.  Think of the cluster like a cubbyhole.  It doesn’t matter if you put something small like a shoe in the cubbyhole or a pillow that fills the entire hole.  The cubbyhole is still a fixed size.  I hate analogies when it comes to this sort of thing but that’s what’s happening on your computer.

Welcome to the wonderful world of bytes and clusters!

Sounds like a bad fruit smooth restaurant… oh well – I hope my article helped.

Если щелкнуть правой кнопкой папку и открыть ее страницу свойств, вы увидите два параметра: «Размер» (Size) и «На диске» (Size on disk). Что, собственно, означают эти цифры? Что они измеряют? Откуда, собственно, берутся сведения в проводнике о размере папки?

При получении информации на странице свойств выполняется простой рекурсивный поиск всех файлов в папке. При этом не предпринимаются попытки отфильтровать имена файлов, ссылающиеся на один физический файл, используя жесткие ссылки. Если у вас нет доступа к какой-то подпапке, рекурсивный поиск проигнорирует ее и размер файлов в ней в общую цифру не попадет.

Но оказывается, что в рекурсивном поиске по подпапкам есть свои хитрости. Одна из «особых» хитростей: точки повторной обработки обнаруживаются и рекурсивные переходы по ним не производятся. Другая хитрость обусловлена простым совпадением: размер символических ссылок на файлы не засчитывается. Причина не в особой «мудрости» кода поиска по подпапкам, а в том, что в файловой системе размер символических ссылок считается равным нулю. Теперь мы знаем, как считается размер файлов, но откуда берутся упомянутые цифры?

Что означает «размер на диске» у папки?

Измерение размера не составляет проблем — надо просто получить перечень размеров всех файлов, возвращенных функцией Find­First­File в структуре WIN32_FIND_DATA (nFile­Size­Low и nFile­Size­High). Но надо помнить, что эти цифры не обязательно верны из-за особенностей обновления записей каталога в файловой системе NTFS. Этому можно посвятить целую книгу, но вкратце суть в том, что возвращенная информация о размере файлов, запись которых не завершилась, не совсем верна, пока не будет закрыт описатель файла. Но даже после этого будет обновлена запись в каталоге, использованная для открытия файла.

С параметром «На диске» (Size on disk) все еще сложнее. Если диск поддерживает сжатие (что можно узнать по состоянию флага FILE_FILE_COMPRESSION, возвращенного функцией Get­Volume­Information) и файл является сжатым или разраженным (флаги FILE_ATTRIBUTE_COMPRESSED, FILE_ATTRIBUTE_SPARSE_FILE), значение параметра «На диске» этого файла будет равным значению, возвращенному функцией Get­Compressed­File­Size.

Это размер сжатого файла (если он сжат) или размер файла за вычетом незанятых частей, которые логически считаются пустыми (если это разреженный файл). Если файл не разрежен и не сжат, параметр «На диске» равен значению, возвращенному функцией Find­First­File, после его округления до ближайшего кластера.

Изначально алгоритм вычисления параметра «На диске» был создан разработчиками Windows 95. Их понимание строения файловой системы происходило из знаний, полученных при работе с MS-DOS. В то время единственной дисковой файловой системой была FAT. Таких вещей, как жесткая ссылка или альтернативный поток данных, еще не существовало. Содержимое файлов хранилось в кластерах.

Все эти принципы в NTFS не работают — даже принцип хранения файлов в кластерах. В NTFS файл может занимать нуль кластеров под данные, разместившись в пространстве основной таблицы файлов (master file table, MFT). Подробнее см. статью The Four Stages of NTFS File Growth. Естественно, что в параметре «На диске» не учитывается пространство, необходимое файловой системе для хранения файла, такое как место, занимаемое именем файла, записью в каталоге, метаданными файла и альтернативными потоками данных.

Значения, отображаемые в параметрах «Размер» (Size) и «На диске» (Size on disk) не нужно использовать, как точный размер «до байта» общего пространства, занимаемого файлами на диске. Это всего лишь грубая оценка, основанная на предположении, что большинство файлов стандартно, а файлов экзотических форматов нет или очень мало. Я имею в виду, что нет жестких ссылок и пренебрежительно мало альтернативных потоков данных. Если в вашем каталоге много жестких ссылок, таких как, например, сами Windows-каталоги, цифры на странице свойств будут неверными.

Можно использовать параметр «На диске» как оценку размера папки, но имейте в виду, что это очень базовая цифра. Если нужно внимательно следить за использованием дискового пространства, лучше воспользуйтесь дисковыми квотами, которые позволяют более точно выполнять эту задачу.

Понравилась статья? Поделить с друзьями:
  • Windows single language change interface language
  • Windows sidebar скачать для windows 7 microsoft
  • Windows sidebar для windows 7 скачать rus
  • Windows sidebar для windows 7 x32
  • Windows sidebar для windows 10 скачать бесплатно