L A Walsh
2019-Nov-14 08:46 UTC
hardlinking missing files from src to a dest: didn't work way I thought it would.
Have a directory with a bunch rpms in it, mostly x86_64. Have another directory with a bunch, mostly 'noarch'. Some of the noarch files are already in the x86_64 dir and don't want to overwrite them. They are on the same physical disk, so really, just want the new 'noarch' files hardlinked into the destination. sitting in the noarch dir, I tried: rsync -auv --ignore-existing \ --link-dest=/tumbleweed/. . /tumbleweed/. I'm not "too" surprised since technically I asked for it to synchronize them, then link them into the same dir, but thought it would at least say something or create the link, but neither happened. I really didn't want to copy them -- I'd really prefer the link, so how do I have it only create a hard link from the source files to target DIR that don't already exist in the target? I know I can do it with a shell script, but I thought rsync might be faster...then again, if I count figuring out how to do it...not so sure.... How can I get rsync to do this? Thanks...
Paul Slootman
2019-Nov-14 09:54 UTC
hardlinking missing files from src to a dest: didn't work way I thought it would.
On Thu 14 Nov 2019, L A Walsh via rsync wrote:> Have a directory with a bunch rpms in it, mostly x86_64. > > Have another directory with a bunch, mostly 'noarch'. > > Some of the noarch files are already in the x86_64 dir > and don't want to overwrite them. They are on the same > physical disk, so really, just want the new 'noarch' files > hardlinked into the destination. > > sitting in the noarch dir, I tried: > rsync -auv --ignore-existing \ > --link-dest=/tumbleweed/. . /tumbleweed/.This is not going to do anything useful, as you're telling it to look in /tumbleweed/ for files that are to be placed in /tumbleweed/ i.e. the exact same location. It's not going to do ln /tumbleweed/foo/bar /tumbleweed/foo/bar which is effectively what you're telling it to do. You need to specify the source directory as the link-dest directory. Paul
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