Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
How can I tar ball a directory hierarchy with soft links in linux

I 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.

share|improve this question

migrated from stackoverflow.com Aug 24 '12 at 16:12

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Daniel Beck Aug 24 '12 at 16:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
What did you find out when you tried a small example test? –  Levon Aug 24 '12 at 15:35
    
Can you clarify what your expectations are. "preserving links" can be understood different ways, especially referring to "those links which use absolute paths". –  jlliagre Aug 24 '12 at 16:11
add comment

4 Answers

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

share|improve this answer
add comment

It can, depending on the options you do/don't give it. Also, with regard to hard links, it will only preserve the hard links within the data set you are currently working with - e.g. if you have a hard link between a file in directory a/ linking to a file in b/, but you're only archiving/unpacking a/, then it won't preserve that link.

share|improve this answer
add comment

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
share|improve this answer
add comment

You should try Rsync in this case.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.