1

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.

2
  • What did you find out when you tried a small example test?
    – Levon
    Aug 24, 2012 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, 2012 at 16:11

4 Answers 4

2

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
1

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

0

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.

0

You should try Rsync in this case.

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