rsync to a symlink directory

Gwendal Stevanazzi stevanazzi at aleks.com
Tue Sep 24 07:29:00 EST 2002


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




More information about the rsync mailing list