Does tar preserve links?
Solution 1
Take a look at the man page, at least for gnu tar:
-h, --dereference
follow symlinks; archive and dump the files
they point to
--hard-dereference
follow hard links; archive and dump the files
they refer to
Solution 2
generally speaking it depends on tar implementations and command line options.
GNU tar has options for that http://www.gnu.org/software/tar/manual/html_node/hard-links.html
I would like to recommend you use cpio instead of tar. cpio format is more portable across UNIX-es and cpio preserves hard links
Related videos on Youtube
Balualways
Linux Enthusiast and explorer, Loves automation and Continuous Delivery, hiking, scripting and vodka
Updated on September 18, 2022Comments
-
Balualways over 1 year
Possible Duplicate:
How can I tar ball a directory hierarchy with soft links in linuxI am using tar to copy files and directories from a Solaris machine to a Linux machine.
- Does Tar preserve the Symbolic Links, Hard links and those links which uses absolute paths?
I am copying the Directories one by one from the root, I am not copying the entire
/
to the new server as I already have few directories setup.-
Levon over 11 yearsWhat did you find out when you tried a small example test?
-
jlliagre over 11 yearsCan you clarify what your expectations are. "preserving links" can be understood different ways, especially referring to "those links which use absolute paths".