I got a tarball (let's say t.tar.gz) that contains the following files


where ./b/b.txt is a hard link to ./a/a.txt.

I want to unpack the tarball on a network file system (AFS) that only supports hard links in the same directory (see here). Therefore, just unpacking it via tar -xzf t.tar.gz raises an error that the hard link ./b/b.txt cannot be created.

So far, my solution to the problem was to unpack ./t.tar.gz on a file system that supports ordinary hard links. Then pack it again with the option --hard-dereference as the GNU tar manual proposes. And lastly, unpack that new tarball into the AFS.

As this is unsatisfactory for me, I'm asking if there is an easier way to get the content of the archive unpacked directly to it's final destination? Such as an equivalent option to --hard-dereference for unpacking instead of archiving?


1 Answer 1


Mount the archive as a directory, for example with AVFS, then use your favorite file copying tool.

cp -a --no-preserve=links ~/.avfs/path/to/t.tar.gz\# target-directory/


rsync -a ~/.avfs/path/to/t.tar.gz\#/ target-directory/
  • Thanks for the introduction to mountavfs. This seems to be the best option for me right now.
    – Denis
    Mar 1, 2016 at 8:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .