archive - Why would a TAR file be smaller than it’s contents? -


I have a directory that I am collecting:

  $ du -sh Old code 1400848 $ tar CF old code.tar oldcode  

The directory is 1.4GB so the file is quite important, however:

  $ ls -l old code .tar-rw-r - r-- 1 i.e. 940339200 2002-01-30 10:33 oldcode.tar  

Only 897mb is not compressed in any way:

  $ file oldcode.tar oldcode.tar: POSIX tar archive  

Why is it a smaller file than content?

You make a difference because of file system work

In short, your Disk is made from clusters Each cluster has a fixed size - we say - 4 kilobytes. If you store 1kb files in such cluster 3kb, then it will not be used. Accurate details vary with different types of file systems, but most file systems work like this.

3kb The wasted place is not too much for a file, but if you have too many files files can become an important part of the trash disk usage.

Files inside the tarch archive are not stored in the cluster, but after one, this is where the difference comes from.


Comments