Perform rsync while following sym links

Scenario / Questions

I have a directory that contains symbolic links to other directories located on different media on my system:

/opt/lun1/2011
/opt/lun1/2010
/opt/lun2/2009
/opt/lun2/2008
/opt/lun3/2007

But the symbolic links show up as:

/files/2011
/files/2010
/files/2009
/files/2008
/files/2007

How can I perform an rsync that follows the symbolic links?

e.g.:

rsync -XXX /files/ user@server:/files/

Find below all possible solutions or suggestions for the above questions..

Suggestion: 1:

The -L flag to rsync will sync the contents of files or directories linked to, rather than the symbolic link.

Suggestion: 2:

Just ran into this problem. And if you want rsync to treat symlinked directories as directories, you want the K option

rsync -K /files/ user@server:/files/

Suggestion: 3:

You need both -L and -K if you have symlinks on both sides, e.g. you already had your 1st rsync done and want to update the backup using rsync.

    -L, --copy-links            transform symlink into referent file/dir
    -K, --keep-dirlinks         treat symlinked dir on receiver as dir

In such cases, if you use only -L, the symlinks on the receiver side will be wiped out and new real dir will be made.

Disclaimer: This has been sourced from a third party syndicated feed through internet. We are not responsibility or liability for its dependability, trustworthiness, reliability and data of the text. We reserves the sole right to alter, delete or remove (without notice) the content in its absolute discretion for any reason whatsoever.

Source: Perform rsync while following sym links

Design a site like this with WordPress.com
Get started