Pierre Bernhardt
2019-Nov-14 13:41 UTC
hardlinking missing files from src to a dest: didn't work way I thought it would.
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 ./ 1 2 sent 194 bytes received 95 bytes 578.00 bytes/sec total size is 10 speedup is 0.03 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 8 257312 -rw-r--r-- 1 pierre pierre 4 Nov 14 10:53 1 257313 -rw-r--r-- 1 pierre pierre 6 Nov 14 10:53 2 Any idea why it's not working? Using cp -l is working well: 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$ cp -l a/* b/. pierre at in94:~/tmp$ ls -li a b a: insgesamt 8 257315 -rw-r--r-- 2 pierre pierre 4 Nov 14 10:53 1 257316 -rw-r--r-- 2 pierre pierre 6 Nov 14 10:53 2 b: insgesamt 8 257315 -rw-r--r-- 2 pierre pierre 4 Nov 14 10:53 1 257316 -rw-r--r-- 2 pierre pierre 6 Nov 14 10:53 2 Cheers, Pierre
Paul Slootman
2019-Nov-14 14:02 UTC
hardlinking missing files from src to a dest: didn't work way I thought it would.
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: aThere'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
Pierre Bernhardt
2019-Nov-14 15:25 UTC
hardlinking missing files from src to a dest: didn't work way I thought it would.
Am 14.11.19 um 15:02 schrieb Paul Slootman via rsync:> On Thu 14 Nov 2019, Pierre Bernhardt via rsync wrote: > 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/Working: 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=$(pwd)/a a/ b/ sending incremental file list ./ sent 98 bytes received 19 bytes 234.00 bytes/sec total size is 10 speedup is 0.09 pierre at in94:~/tmp$ ls -li a b a: insgesamt 8 257315 -rw-r--r-- 2 pierre pierre 4 Nov 14 10:53 1 257316 -rw-r--r-- 2 pierre pierre 6 Nov 14 10:53 2 b: insgesamt 8 257315 -rw-r--r-- 2 pierre pierre 4 Nov 14 10:53 1 257316 -rw-r--r-- 2 pierre pierre 6 Nov 14 10:53 2 But it's really complex to understand. Why it's not possble to simply create hard links if source and target is on the same filesystem and use a simple option instead of the sourc-link-complex-option. Is this for linke backup reason if the source dir is different from the link-dest dir because of different hosts like rsync -av --dest-link=../a a/ backuphost:b/ where on backuphost a is an older copy and b is the new target? Cheers,