rsync to a symlink directory
Gwendal Stevanazzi
stevanazzi at aleks.com
Tue Sep 24 19:54:00 EST 2002
On Tue, 24 Sep 2002 tim.conway at philips.com wrote:
> Here's the script:
> ++++++++++++++++++++++++++++++++++++++++++++++++++++
> #!/bin/sh
>
> {
> echo starting on `uname -a`
> rm -rf dira dirb dirc
> mkdir dira
> mkdir dirb
> ln -s dirb dirc
> date >dira/file
> rsync dira/file dirc
> ls -ld `find dirb -print`
> echo finished on `uname -a`
> } >> $HOME/netapp/rsyncsymlinktest.log 2>&1
> ++++++++++++++++++++++++++++++++++++++++++++++++++++
> and here's the output, run on 4 different architectures:
> ++++++++++++++++++++++++++++++++++++++++++++++++++++
> starting on Linux arwen.ustc.sc.philips.com 2.4.18-6mdkenterprise #1 SMP
> Fri Mar 15 02:28:20 CET 2002 i686 unknown
> drwxr-xr-x 2 tconway Vlsieng 4096 Sep 24 12:53 dirb
> -rw-r--r-- 1 tconway Vlsieng 29 Sep 24 12:53 dirb/file
> finished on Linux arwen.ustc.sc.philips.com 2.4.18-6mdkenterprise #1 SMP
> Fri Mar 15 02:28:20 CET 2002 i686 unknown
> ++++++++++++++++++++++++++++++++++++++++++++++++++++
> What platform are you on? What's the version of rsync? What's the
> filesystem?
This script runs ok
starting on Linux shannon 2.4.18 #2 Fri Apr 19 11:33:47 PDT 2002 i686 unknown unknown GNU/Linux
drwxr-xr-x 2 gwen gwen 4.0K Sep 24 12:22 dirb/
-rw-r--r-- 1 gwen gwen 29 Sep 24 12:22 dirb/file
finished on Linux shannon 2.4.18 #2 Fri Apr 19 11:33:47 PDT 2002 i686 unknown unknown GNU/Linux
But here is a script which doesn't work for me:
{
echo starting on `uname -a`
rm -rf source dest
mkdir -p source/dira
mkdir -p dest/dirb
ln -s dirb dest/dira
date >source/dira/file
date >dest/dira/file2
cd source
echo "Before"
ls -ld `find ../dest -print`
rsync -R dira/file ../dest/
echo "After"
ls -ld `find ../dest -print`
echo finished on `uname -a`
cd ..
}
And here is the output:
starting on Linux shannon 2.4.18 #2 Fri Apr 19 11:33:47 PDT 2002 i686 unknown unknown GNU/Linux
Before
drwxr-xr-x 3 gwen gwen 4.0K Sep 24 12:33 ../dest/
lrwxrwxrwx 1 gwen gwen 4 Sep 24 12:33 ../dest/dira -> dirb/
drwxr-xr-x 2 gwen gwen 4.0K Sep 24 12:33 ../dest/dirb/
-rw-r--r-- 1 gwen gwen 29 Sep 24 12:33 ../dest/dirb/file2
After
drwxr-xr-x 4 gwen gwen 4.0K Sep 24 12:33 ../dest/
drwxr-xr-x 2 gwen gwen 4.0K Sep 24 12:33 ../dest/dira/
-rw-r--r-- 1 gwen gwen 29 Sep 24 12:33 ../dest/dira/file
drwxr-xr-x 2 gwen gwen 4.0K Sep 24 12:33 ../dest/dirb/
-rw-r--r-- 1 gwen gwen 29 Sep 24 12:33 ../dest/dirb/file2
finished on Linux shannon 2.4.18 #2 Fri Apr 19 11:33:47 PDT 2002 i686 unknown unknown GNU/Linux
As you can see, I can no longer access dest/dira/file2.
I also tried stuff like rsync -R dira/file ../dest/dira/.././
with the same result.
--
Gwen
>
>
> Tim Conway
> tim.conway at philips.com
> 303.682.4917 office, 303.921.0301 cell
> Philips Semiconductor - Longmont TC
> 1880 Industrial Circle, Suite D
> Longmont, CO 80501
> Available via SameTime Connect within Philips, caesupport2 on AIM
> "There are some who call me.... Tim?"
>
>
>
>
> Sriram Ramkrishna <sramkris at ichips.intel.com>
> Sent by: rsync-admin at lists.samba.org
> 09/24/2002 10:19 AM
>
>
> To: Gwendal Stevanazzi <stevanazzi at aleks.com>
> cc: jw schultz <jw at pegasys.ws>
> rsync at lists.samba.org
> (bcc: Tim Conway/LMT/SC/PHILIPS)
> Subject: Re: rsync to a symlink directory
> Classification:
>
>
>
> I've always tried just appending a trailing slash to the destination
> that always worked for me.
>
> sri
>
> On Tue, Sep 24, 2002 at 12:28:02AM -0700, Gwendal Stevanazzi wrote:
> > On Mon, 23 Sep 2002, jw schultz wrote:
> >
> > > On Mon, Sep 23, 2002 at 06:03:12PM -0700, Gwendal Stevanazzi wrote:
> > > >
> > > > Here is the structure of my servers :
> > > >
> > > > Source :
> > > >
> > > > /home/test1/link_dir
> > > > sub_dir1
> > > > file1
> > > > file2
> > > > ...
> > > > sub_dir2
> > > > ...
> > > >
> > > > Destination:
> > > >
> > > > /home/test2/real_dir
> > > > sub_dir1
> > > > file1
> > > > file2
> > > > ...
> > > > subdir2
> > > > ...
> > > > /home/test2/link_dir@ -> real_dir
> > > >
> > > >
> > > >
> > > > Now I want to update file1.
> > > > If I run the command
> > > > rsync -aRz file1 destination:/home/test2/link_dir/sub_dir1
> > > > from /home/test1/link_dir/sub_dir1 on source, no problem, the file
> is
> > > > updated.
> > > >
> > > > If I run the command
> > > > rsync -aRz link_dir/sub_dir1/file1 destination:/home/test2/
> > > > from /home/test1 on source, the new fs structure on destination is:
> > > >
> > > > /home/test2/real_dir
> > > > sub_dir1
> > > > file1
> > > > file2
> > > > ...
> > > > subdir2
> > > > ...
> > > >
> > > > /home/test2/link_dir
> > > > sub_dir1
> > > > file1
> > > >
> > > > The symlink is erase and replace by a 'real' directory.
> > > >
> > > >
> > > > Is it the expected behaviour?
> > > >
> > > > How could I prevent this kind of things to happen ?
> > >
> > > It is inferred because you haven't yet traversed the link
> > > and since rsync doesn't see a directory it will create one. Try
> > > rsync -aRz link_dir/sub_dir1/file1 destination:/home/test2/./
> > > to force the traversal of the link so it is already inside
> > > the destination.
> >
> > Thanks for your quick answer, but unforunately it didn't work any
> better.
> >
> > Here is the output of the command with -v and --stats if it helps:
> >
> > building file list ... done
> > link_dir/
> > link_dir/sub_dir1/
> > link_dir/sub_dir1/file1
> > rsync[17349] (server receiver) heap statistics:
> > arena: 123544 (bytes from sbrk)
> > rsync[17347] (sender) heap statistics:
> > arena: 336536 (bytes from sbrk)
> > ordblks: 2 (chunks not in use)
> > smblks: 0
> > hblks: 0 (chunks from mmap)
> > hblkhd: 0 (bytes from mmap)
> > usmblks: 0
> > fsmblks: 0
> > uordblks: 326880 (bytes used)
> > fordblks: 9656 (bytes free)
> > keepcost: 5560 (bytes in releasable chunk)
> >
> > Number of files: 3
> > Number of files transferred: 1
> > Total file size: 266240 bytes
> > Total transferred file size: 266240 bytes
> > Literal data: 266240 bytes
> > Matched data: 0 bytes
> > File list size: 96
> > Total bytes written: 266517
> > Total bytes read: 36
> >
> > wrote 266517 bytes read 36 bytes 533106.00 bytes/sec
> > total size is 266240 speedup is 1.00
> >
> >
> > This test was done with rsync version 2.5.6cvs protocol version 26
> > but I don't think it matters ...
> >
> >
> > --
> > Gwen
> >
> > --
> > To unsubscribe or change options:
> http://lists.samba.org/mailman/listinfo/rsync
> > Before posting, read:
> http://www.tuxedo.org/~esr/faqs/smart-questions.html
>
More information about the rsync
mailing list