LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-19-2007, 06:08 AM   #1
davidb2002
LQ Newbie
 
Registered: Oct 2007
Location: UK
Distribution: Centos 5
Posts: 18

Rep: Reputation: 0
Question 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.
 
Old 10-19-2007, 07:39 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,135

Rep: Reputation: 230Reputation: 230Reputation: 230
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"?
 
Old 10-19-2007, 07:42 AM   #3
davidb2002
LQ Newbie
 
Registered: Oct 2007
Location: UK
Distribution: Centos 5
Posts: 18

Original Poster
Rep: Reputation: 0
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.
 
Old 10-19-2007, 07:59 AM   #4
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,135

Rep: Reputation: 230Reputation: 230Reputation: 230
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.
 
Old 10-19-2007, 08:18 AM   #5
davidb2002
LQ Newbie
 
Registered: Oct 2007
Location: UK
Distribution: Centos 5
Posts: 18

Original Poster
Rep: Reputation: 0
Ill try removing the -a and using -L -K
 
Old 10-19-2007, 09:14 AM   #6
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,135

Rep: Reputation: 230Reputation: 230Reputation: 230
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"?
 
Old 10-19-2007, 09:29 AM   #7
davidb2002
LQ Newbie
 
Registered: Oct 2007
Location: UK
Distribution: Centos 5
Posts: 18

Original Poster
Rep: Reputation: 0
Ill try that then thanks for the help so far guys
 
Old 10-20-2007, 08:46 PM   #8
walla299
Member
 
Registered: Jul 2007
Location: Phoenix, AZ, US
Distribution: OpenSuse 11.1 x64 (KDE 4.3)
Posts: 35

Rep: Reputation: 15
Quote:
Originally Posted by davidb2002 View Post
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.
 
Old 10-22-2007, 03:19 AM   #9
davidb2002
LQ Newbie
 
Registered: Oct 2007
Location: UK
Distribution: Centos 5
Posts: 18

Original Poster
Rep: Reputation: 0
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.
 
Old 10-24-2007, 03:17 PM   #10
downneck
LQ Newbie
 
Registered: Oct 2007
Posts: 1

Rep: Reputation: 0
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync: error while copying Fusi Linux - Software 5 06-09-2013 11:00 PM
prevent rsync from copying open files? bkeeper Linux - General 2 12-11-2006 04:16 AM
Windows Rsync Upload to Linux Rsync - permissions inspleak Linux - Software 0 10-12-2004 02:49 PM
Copying from Slackware 10 to Debian Sarge using rsync apolinsky Slackware 5 10-07-2004 09:17 AM
copying over a symlink acid_kewpie Linux - General 5 09-24-2002 08:26 AM


All times are GMT -5. The time now is 05:17 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration