Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have an issue with a tarball created on a SuSe 10.3 Server version. The .tar file has a size of 6.5 GB but if I untar it under Ubuntu 9.10 the resulting folder only has a size of 1.5 GB.

commands used: tar cvf for packing, tar xvf for unpacking.

Perhaps somebody knows how this can be fixed, would be great,

cheers

share|improve this question

4 Answers 4

if you have symlinks or hardlinks in the directory, then tar might be adding each one as a seperate file. When you then decompress it on a linux filesystem, it would reinstate the links and then everything would take up less space.

Tar is not for compression, just for creating a file containing multiple files. That is why you usually find it piped through gzip or bzip.

share|improve this answer
1  
There are versions of tar out there that will do compression and decompression, but "cvf" and "xvf" aren't going to trigger that, in any version I know of. –  David Thornley Jan 30 '10 at 15:54
    
some versions of tar (gnu tar does, irrc) have wrappers to decompress bzip/gzip etc... compressed tar files, but I was under the impression that they relied on the native libs from the compression schema. –  BuildTheRobots Feb 1 '10 at 3:18

you may have better results with cpio , it's much more suited for larger backups and can be scripted to handle sym links and special files correctly.

share|improve this answer

If you have lots of small files then you may run into blocking and directory overhead in tar. The important information is how large was the source directory. tar may have compressed empty space in files by not allocating blocks for them. Try the --apparent-size option to du.

You could try comparing the list of files generated by tar -tf to the files extracted. Extract with tar -xf to see if you are getting any errors on extract. Try recreating a copy of the tar to see how large it is.

share|improve this answer

I'd suggest trying pax. At least, this is how it's called in CentOS. IIRC, it can handle corrupted TAR files by skipping the invalid tar members. Otherwise I suggest you experiment with the tarfile module of the Python standard library and do this programmatically. I had done something like that a few years ago.

share|improve this answer

Your Answer

 
discard

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