Why is the tar file bigger than the directory backed up

disk-usagetar

This question did not help me (despite having the same title). So I post this even though this is a duplicate question.

As far as I can tell, the total in du -k includes all the subdirectories and indicates I have 77 megabytes of data

/raid/fpuData/oldOutput>du -ks
77063332        .
/raid/fpuData/oldOutput>tar -cvzf ../oldOutput.tar.zip *

The backup is sill running, but already the file is considerably bigger than 77 megabytes

/raid/fpuData>ls oldOutput.tar.zip
-rw-r--r-- 1 nobody nobody 14470610944 Jul  1 22:18 oldOutput.tar.zip

The files I'm backing up are all huge text files filled with numbers, like a huge comma delimited spreadsheet). Something like this

0.3454915028125262743685653,0.5590169943749474512628694,...
0.221761776923297210251107,0.3588180924674668759166707,...
-0.06101864995889930837202897,-0.09873024958113109372792593,...
-0.3001958820500086333460388,-0.4857271404396689140625654,...
...

Why is the tar file bigger than the directory? It should be compressed because I'm using the data with the z option. What's the point of tarring it, then?

Best Answer

Your compressed tar file is smaller than its contents.

ls prints file sizes in bytes by default.
du -k prints file sizes in kilobytes.

0610944B ≈ 14131456KB < 77063332KB

To make ls print file sizes in kilobytes, use the -k flag.

Related Question