Ignore Symlinks when Extracting Tarball
-h (or --dereference) to dereference will only work upon creation.
Reference: http://www.gnu.org/software/tar/manual/tar.html#SEC138
According to a similar answer here: How do I dereference links when extracting from a tar file? you can mount the archive then copy from it, though I have not tested this myself.
Related videos on Youtube
MysteryMoose
Updated on September 18, 2022Comments
-
MysteryMoose over 1 year
I am attempting to extract a tarball (*.tgz, to be exact) and receiving terminal errors on extracted symlinks. Unfortunately, I cannot simply recreate the archive as this is a legacy archive for a system that no longer exists which was created before I was even out of high school (have to love working for a big company).
I have consulted the almighty Google; however all I can seem to find is information for excluding / following symlinks at creation time. The exact error I am receiving is something of a misnomer (error: read-only filesystem) and comes from the fact that a very large portion of the data payload is contained within numerous squash / cram / loop filesystems. The symlinks are referencing data within them which, obviously, cannot be mounted due to errors while extracting said tarball. Chicken; meet egg.
So, in short:
How can I extract a *.tgz archive to completion while either ignoring symlinks or ignoring resultant symlink errors?
For reference:
$ tar --version tar (GNU tar) 1.26 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by John Gilmore and Jay Fenlason. $ uname -a Linux localhost.localdomain 3.7.9-205.fc18.x86_64 #1 SMP Sun Feb 24 20:10:02 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
-
Gilles 'SO- stop being evil' almost 11 yearsI don't understand the problem. Please post a transcript of untarring, and the output of
tar -xvf
. Are these symlinks to directories?
-
-
MysteryMoose almost 11 yearsHandy little tidbit to know, thanks! For those who may come looking later: AVFS does work, however it is not immediately available for Fedora 18 x64. It can, however be download without issue and locally installed via yum (use yum; it will grab the FUSE dependency for you). Once I was 'in' the *.tgz archive, the copy went off without a hitch.