I have a directory full of incremental backups (~20GB) which I need to copy (or move) from one partition to another. This directory contains daily snapshots which have been produced using cp -al to create symlinks to duplicate files rather than copies.

I need to copy this structure as-is, preserving the links within, but when I run a cp -r it seemed that files were being created rather than links (I'm assuming this because the copy uses more free disk space than the original after a small portion of it is copied).

How can I copy this directory to another disk, whilst preserving the link structure? And how can I know that it's copied as links? (seems hard to verify as du incldues the filesize regardless)

2 Answers 2


Use rsync. From its manpage:

          rsync -avz foo:src/bar /data/tmp

   This  would  recursively transfer all files from the directory src/bar on the machine foo into the /data/tmp/bar directory on the local machine. The files are transferred in "archive" mode, which ensures that sym‐
   bolic links, devices, attributes, permissions, ownerships, etc. are preserved in the transfer.  Additionally, compression will be used to reduce the size of data portions of the transfer.

For what is worth, du can follow symlinks or not:

   -L, --dereference
          dereference all symbolic links

   -P, --no-dereference
          don't follow any symbolic links (this is the default)
  • I did consider rsync, but was worried it would preserve the link to the original original file instead of the copy of the original file (if that makes sense!). Useful tip on du May 6, 2014 at 11:13

tar might be helpful, e.g.

tar cf - . | (cd /otherdirectory; tar xvf -)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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