Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I am currently trying to set up a program concerning directory sizes, and I found somethin peculiar: in windows explorer, when you right click (properties) and look at the size of a directory (and its subdirs) .. you have two sizes : 'Size' and 'Size on disk'It wouldn't be a problem, if those figures would be the same, but they are not always just that. It appears in dirs with may subdirs apparently, and probably this is the cause of fragmentation.
Question is: which one is the real size, given the fact I am only interested in the total number of bytes by all files togheter ? Why is there a difference ? Does a directory also have a 'size' ?
I have seen differences of 4 megabyte on 180 megabyte, so it's not a small diff.

Data is allocated on a disk in arbitrarty blocks not byte by byte. On a FAT32 file system (most common one), data is allocated in chunks of 4096 bytes (4Kb). When a file is stored onto these allocation units, either a whole unit is taken up or nothing, You cannot use half an allocaion unit. As a result, if the size of a particular file is not a multiple of 4096 bytes, there is some space wasted (e.g. a 4097 byte file will take up 8192 bytes on your disk because it will need to take up a whole new allocation unit to store just that extra byte). The "size on disk" is the total amount of space allocated to the data on your hard disk (including wasted space), while "size" means simply how much data is stored. You will note that if you have the FAT32 file system, the "size on disk" will always be a multiple of 4096 bytes.

Steve's explanation is correct, except that the "allocation unit" is based on the size of the particular disk partition.
Up to 8GB, the size is 4K.
8-16 it is 8K
16-32 it is 16K
and over 32 it is 32Kwhere 1K=1024 bytes

OK, that explains a lot already !
Next step would be, assume I am copying these files to a cd-rom, and I know from advance exactly how much space I got on the disc ...
Which size must I refer to from source ? Does a cd-rom also use the same storage technique ? Or do they just write files and nothing else ?

Cdroms use an entirely different system and the 'size' comes closest. Your burner program should give you a good approximation but I have learned from experience to always leave a little margin for error.

Hi all,
My 2 cents: the name of the "chunk" is cluster (the storage unit on a disk).
Have a look at the Dos command CHKDSK and you'll see the size of the cluster on your disk.
Below is the explanation:
You know about the FAT = File Allocation Table which is an index in which you've a record to describe each cluster.FAT16 (old FAT system) was coded on 16 bits
ie there were 2**16 = 65,536 possible clusters in a partition and the size of a cluster was Total-size/65536 so that a 2 GB disk had a 32 KB cluster (a little 10 Byte file was in fact 32,000 bytes!)You understand the most space on a disk!
You understand why we tended to partition large disks!
You understand why we welcomed FAT32 (addresses were coded on 32 bits hence a possible 2**32 number of clusters on a partition).
NB: Drive Space and other such programs are storing several files in a cluster).Gérard from Paris, France

CDs do not use the FAT system and the size on disk is approximately the same as the size of the file(s).

![]() |
Login without logon
|
troubleshoot zip drive
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |