LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Rsync not copying symlink (https://www.linuxquestions.org/questions/linux-software-2/rsync-not-copying-symlink-592967/)

davidb2002 10-19-2007 06:08 AM

Rsync not copying symlink
 
Due to some space issues we replaced the images directory wit ha symlink by the same name images. It seems that my rsync command isn't following the symlink for the images directory. I have rsync 2.6.3. How do i get it to work as it hasn't backed up any images created since the switch over to the symlink?

command:
/usr/bin/rsync --compress -a -L -k --progress --stats --exclude 'logs/' \
--exclude 'cache/' --exclude 'templates_c/' --exclude 'postgres/' \
--exclude 'mysql/' --exclude 'lost+found/' --exclude 'qscand/' \
--exclude 'vpopmail/' --exclude 'spamd/' --exclude 'tmp/' --exclude 'sqlcache/' \
--exclude 'servint/' \
/home/ /storage1/backup/

I have tried -k and -K. It has a backup directory called images already, but its not continueing with the symlink content into that directory.

Guttorm 10-19-2007 07:39 AM

Hi

From man rsync:
-a, --archive archive mode; same as -rlptgoD (no -H)
-l, --links copy symlinks as symlinks
-L, --copy-links transform symlink into referent file/dir
--copy-unsafe-links only "unsafe" symlinks are transformed
--safe-links ignore symlinks that point outside the tree

So you're telling rsync both -l (copy symlinks as symlinks) and -L (transform symlink into referent file/dir)

Maybe change "-a" into "-rptgoD"?

davidb2002 10-19-2007 07:42 AM

From what it sounds, -L is what I want. I want it to copy the data in the symlink to a backup directory. However its not.

Guttorm 10-19-2007 07:59 AM

Well did you try without the -a option? I don't have the same version, but when I specified both -l and -L, I got the -l behaviour when I tried. Passing -k gave an error message - I don't know what it means.

davidb2002 10-19-2007 08:18 AM

Ill try removing the -a and using -L -K

Guttorm 10-19-2007 09:14 AM

Well, as I said, "-a" is the same as -rlptgoD" (-r -l -p - t -g - o -D), so you'll then lose stuff like ownership and permissions.

Why not change it to "-rptgoDLK"?

davidb2002 10-19-2007 09:29 AM

Ill try that then ;) thanks for the help so far guys

walla299 10-20-2007 08:46 PM

Quote:

Originally Posted by davidb2002 (Post 2929491)
Due to some space issues we replaced the images directory wit ha symlink by the same name images. It seems that my rsync command isn't following the symlink for the images directory. I have rsync 2.6.3. How do i get it to work as it hasn't backed up any images created since the switch over to the symlink?

command:
/usr/bin/rsync --compress -a -L -k --progress --stats --exclude 'logs/' \
--exclude 'cache/' --exclude 'templates_c/' --exclude 'postgres/' \
--exclude 'mysql/' --exclude 'lost+found/' --exclude 'qscand/' \
--exclude 'vpopmail/' --exclude 'spamd/' --exclude 'tmp/' --exclude 'sqlcache/' \
--exclude 'servint/' \
/home/ /storage1/backup/

I have tried -k and -K. It has a backup directory called images already, but its not continueing with the symlink content into that directory.

I had an unintended experience of the behavior you say you are looking for. This happened with rsync version 2.6.3, if I remember correctly. I was setting up a portable update mirror to use on systems with no internet connection and wound up with a huge download because I forgot to put a "-l" command in my command line. It seems that rsync defaults to following symlinks and copying them as files. The "-l" option told it to just copy them as links. The "-L" you've included should give what you want, though.

davidb2002 10-22-2007 03:19 AM

Well i have tried this:

/usr/bin/rsync --compress -rptgoDLK --progress --stats --exclude 'logs/' \ --exclude 'cache/' --exclude 'templates_c/' --exclude 'postgres/' \ --exclude 'mysql/' --exclude 'lost+found/' --exclude 'qscand/' \ --exclude 'vpopmail/' --exclude 'spamd/' --exclude 'tmp/' --exclude 'sqlcache/' \--exclude 'servint/' \/home/ /storage1/backup/

It doesn't seem to work when i try to run it from the root directory. Its not even backing up new files regardless of the symlink.

downneck 10-24-2007 03:17 PM

use --force, it'll delete non-empty directories and replace them with symlinks

make sure you don't need anything in the destination directory, first ;)


All times are GMT -5. The time now is 12:17 AM.