# Get tar's uncompressed size



## Seeker (Jul 27, 2011)

Using cmd to list compressed tar archive shows it's uncompressed size is: *473 MB*
However, when I do uncompress it, on UFS (HDD) it's size is *535 MB*

I've tried to calculate tar's size by method where, if size of file is less then sector size (512), then round it to 512 bytes.
This lifted *473 MB* to *477 MB*.
Duh! Not even close to *535 MB*.

So?
What should I do?


----------



## phoenix (Jul 27, 2011)

Files are stored on disk using complete sectors, thus all on-disk file sizes will be multiples of 512 B.  However, UFS smallest addressable block is (I believe) something like 2K.  So files that are 3 KB in size will use 4 KB of disk space.  Any files that aren't perfect multiples of the block size will "waste" the space at the end of the block, thus inflating the on-disk sizes.

Or, something along those lines.

This was most noticeable with FAT32 where the allocation size on large partitions was 32KB, so a tiny 1 KB file would "waste" 31 KB of disk.


----------



## Seeker (Jul 27, 2011)

Well, for UFS, it defaults to: block size of 16384 bytes (16 KB), a fragment size of 2048 bytes (2 KB)
When a file greater than 16 KB is created, ie: 19K file, it will occupy 1 block and 2 fragments from the next block(1 block holds 8 fragments).
Now I went for a fragment size of 2048 bytes, this calculated size to *499 MB*.
Still not close to *535 MB*.


----------

