Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I had this file structure:

2000/
  001.txt
  002.txt
  003.txt
  ...
2001/
  ...
2002/
  ...
...
2011/

I guess file structure doesn't matter, but anyway...
So folders are representing couple of years with some text files inside.

Now I compress all, with Nautilus compress context menu (archive manager) in tar.gz format. I choose this format as although it requires more space then bz2, it's lot faster when I need to query data inside.

After this I create helper text file with references about archive contents (170 KB in size) and wanted to add it to archive, so I just drag & drop this file onto created archive in Nautilus.

Two bad things happen:

  1. Droping file onto archive extracts whole archive in temp folder then re-compresses all files again! This is just awful for large archives, and I hope to find better way in Terminal later

  2. Initial archive was ~ 96 MB in size, and now just by adding this 170 KB text file, archive become 140 MB! I checked inside it's same content + this tiny text file

Why is this?


I just created archive with contents from two subfolders, than drag&drop file with size of 100 bytes:

$ gzip -l tmp-original.tar.gz
         compressed        uncompressed  ratio uncompressed_name
           13297512            69908480  81.0% tmp-original.tar
$ gzip -l tmp-updated.tar.gz 
         compressed        uncompressed  ratio uncompressed_name
           19231941            69908480  72.5% tmp-updated.tar
share|improve this question

1 Answer 1

As a note on point one, as a far as I can tell, the tar terminal command cannot append files to a compressed archive (ex. your .gz archive), and hence needs first to uncompress the archive, then add the appended file, and recompress again. A workaround could be mounting your compressed archive using archivemount (instructions here), which allows you to mount your compressed archive, append files, and unmount it. Whether this is speedier than uncompressing, appending and recompressing, I cannot say.

share|improve this answer
    
Yes, you are right. In either case (using Nautilus' archive manager or Terminal) archive needs to be uncompressed then appended, and re-compressed again. Thanks for your archivemount suggestion, but I think I'll go with RAR. I just tested, and querying is at same speed as with tag.gz, and has lot of other handy options which makes it more sane choice instead using compressed tar. –  zetah Mar 30 '12 at 2:54
    
Also I noticed that compressing to RAR with Nautilus archive manager, resulting archive is not compressed with default RAR setting (-m3) but with fastest setting (-m1), which is really bad decision, as if this program does not allow setting compression levels than it should not tweak defaults, which user should expects. Default setting isn't there without reason –  zetah Mar 30 '12 at 2:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.