Specifying tmp for tar

Joe Smith jes at martnet.com
Sat Sep 1 03:22:55 UTC 2007


Dotan Cohen wrote:
> I have a 2 GB bz2 archive that unzips to over 10 GB (wikipedia dump).
> Although I have over 50 GB free in /home, / has only about 8 GB free.
> Thus, as tar uses /tmp, the / filesystem fills up and I cannot
> continue. How can I specify a tmp directory for tar in my home
> directory? Note that man tar makes no mention of a tmp option.

Something seems funky here: there's no reason for tar to need a temp 
space to unpack an archive.

I just checked an strace log from GNU tar unpacking a small 
bzip2-compressed archive and /tmp was not touched. The decompression and 
unpacking of the archive should all be streamed through pipes and no 
temporary files should be needed.

How are you invoking it? Are you using GNU tar?

Surely you're doing this on the command line and not through some 
front-end like file-roller, right?

At any rate you should be able to use something like this:

$ mkdir $HOME/tmp
$ TMPDIR=$HOME/tmp tar xjf archive.tar.bz2

to force tar and anything it runs to use your $HOME for the temp files.

You should also be able to force the unpacking to stream by setting it 
up manually:

$ bzcat archive.tar.bz2 | tar xf -

That should not require any temp space at all.

If it were me, I would want to understand why the temp files are needed.

<Joe




More information about the fedora-list mailing list