hardlinking missing files from src to a dest: didn't work way I thought it would.

Paul Slootman paul+rsync at wurtel.net
Thu Nov 14 14:02:00 UTC 2019


On Thu 14 Nov 2019, Pierre Bernhardt via rsync wrote:
> Am 14.11.19 um 10:54 schrieb Paul Slootman via rsync:
> > You need to specify the source directory as the link-dest directory.
> 
> Hi, I tried it also because it's an old question which has never worked
> for me. Instead it creates copies and not hard links:
> 
> 
> pierre at in94:~/tmp$ ls -li a b
> a:
> insgesamt 8
> 257315 -rw-r--r-- 1 pierre pierre 4 Nov 14 10:53 1
> 257316 -rw-r--r-- 1 pierre pierre 6 Nov 14 10:53 2
> 
> b:
> insgesamt 0
> pierre at in94:~/tmp$ rsync -av --link-dest=a a/ b/
> sending incremental file list
> --link-dest arg does not exist: a

There's your clue.
>From the manpage:

    If DIR is a relative path, it is relative to the destination
    directory.

So it's looking for b/a as the link-dest directory.

Use a full pathname for --link-dest to remove all uncertainty.
E.g.:

    rsync -av --link-dest=$(pwd)/a a/ b/

In this case, as the destination is also in same current directory, you
could use:

    rsync -av --link-dest=../a a/ b/


Paul



More information about the rsync mailing list