--link-dest isn't linking

Paul Slootman paul+rsync at wurtel.net
Mon Apr 23 10:01:55 MDT 2012


On Mon 23 Apr 2012, darxus at chaosreigns.com wrote:
> On 04/23, Paul Slootman wrote:
> > On Sun 22 Apr 2012, darxus at chaosreigns.com wrote:
> > 
> > > rsync -Ha --link-dest=/media/4tb/bak/panic-2012-01-01 /media/2tb/bak/panic-2012-02-01 /media/4tb/bak/
> > > 
> > > root at dancer:/media/4tb/bak# ls -l panic*/home/darxus/0000_latest.jpg
> > > -rw------- 15 darxus darxus 100772 1999-09-14 21:19 panic-2011-12-20/home/darxus/0000_latest.jpg
> > > -rw------- 15 darxus darxus 100772 1999-09-14 21:19 panic-2012-01-01/home/darxus/0000_latest.jpg
> > > -rw-------  1 darxus darxus 100772 1999-09-14 21:19 panic-2012-02-01/home/darxus/0000_latest.jpg
> > > 
> > > Why isn't it hard linking?  This is driving me nuts.
> > > 
> > > When I do --itemize-changes, for that file, it says:
> > > >f+++++++++ panic-2012-02-01/home/darxus/0000_latest.jpg
> > 
> > There is no file "panic-2012-02-01/home/darxus/0000_latest.jpg" in the
> > --link-dest directory. There _is_ a home/darxus/0000_latest.jpg file,
> > but that's not what's being looked for.
> 
> That would make sense IF 0000_latest.jpg got written as
> /media/4tb/bak/home/darxus/0000_latest.jpg (omitting "panic-2012-02-01").

No, that's not true.

> But it didn't, it was written as I expected to
> /media/2tb/bak/panic-2012-02-01/home/darxus/0000_latest.jpg
> 
> Surely this is a bug?

No.
If you pass "<whatever>/panic-2012-02-01" as a source, then all
transmitted filenames WILL begin with panic-2012-02-01 .
Well documented, although you may need to be intimately familiar with
the docs to know this :)

> Created intentionally to test my sanity.
> 
> > Try modifying your command to:
> > 
> >     rsync -Ha --link-dest=/media/4tb/bak/panic-2012-01-01/ /media/2tb/bak/panic-2012-02-01/ /media/4tb/bak/panic-2012-02-01/
> > 
> > (Whenever in doubt, use trailing slashes :-)
> 
> That did it.  Thank you very much.
> 
> Bug, right?

Again, NO.

Because of the trailing slash in the source argument, the filenames
transmitted will begin with whatever is _below_ the panic-2012-01-01
directory. Hence the matching with the filenames in the link-dest dir
will succeed.


Paul


More information about the rsync mailing list