Wieder was gelernt

rsync --link-dest

Tags: linux cli sync quirks
2020-07-10

Bei rsync --link-dest=D ist D relativ zum Zieldirectory, nicht zum current working directory. Das ist zwar logisch (das Ziel-Directory könnte ja auf einem anderen Host liegen), aber trotzdem überraschend.

trintignant:~/tmp 13:31 :-) 1015% rsync -av EO107csv/ a/
sending incremental file list
created directory a
./
EO107_INTERNET_1_10062020095421358.csv
EO107_INTERNET_2_10062020113644.csv
EO_EDITIONS_10062020095813917.csv

sent 195,860,046 bytes  received 100 bytes  130,573,430.67 bytes/sec
total size is 195,811,939  speedup is 1.00
trintignant:~/tmp 13:33 :-) 1019% ll -i a
total 187M
6036618 -rw-r--r-- 2 hjp hjp 46M Jun 10 09:56 EO107_INTERNET_1_10062020095421358.csv
6036619 -rw-r--r-- 2 hjp hjp 46M Jun 10 11:38 EO107_INTERNET_2_10062020113644.csv
6036620 -rw-r--r-- 2 hjp hjp 96M Jun 10 10:00 EO_EDITIONS_10062020095813917.csv

Das hier funktioniert also nicht:

trintignant:~/tmp 13:31 :-) 1016% rsync -av EO107csv/ --link-dest=a/ b/
sending incremental file list
created directory b
--link-dest arg does not exist: a
./
EO107_INTERNET_1_10062020095421358.csv
EO107_INTERNET_2_10062020113644.csv
EO_EDITIONS_10062020095813917.csv

sent 195,860,046 bytes  received 138 bytes  391,720,368.00 bytes/sec
total size is 195,811,939  speedup is 1.00
trintignant:~/tmp 13:32 :-) 1017% ll -i b
total 187M
6036686 -rw-r--r-- 1 hjp hjp 46M Jun 10 09:56 EO107_INTERNET_1_10062020095421358.csv
6036687 -rw-r--r-- 1 hjp hjp 46M Jun 10 11:38 EO107_INTERNET_2_10062020113644.csv
6036702 -rw-r--r-- 1 hjp hjp 96M Jun 10 10:00 EO_EDITIONS_10062020095813917.csv

Das aber schon:

trintignant:~/tmp 13:33 :-) 1021% rsync -av EO107csv/ --link-dest=../a/ d/
sending incremental file list
created directory d

sent 175 bytes  received 36 bytes  422.00 bytes/sec
total size is 195,811,939  speedup is 928,018.67
trintignant:~/tmp 13:33 :-) 1022% ll -i d
total 187M
6036618 -rw-r--r-- 3 hjp hjp 46M Jun 10 09:56 EO107_INTERNET_1_10062020095421358.csv
6036619 -rw-r--r-- 3 hjp hjp 46M Jun 10 11:38 EO107_INTERNET_2_10062020113644.csv
6036620 -rw-r--r-- 3 hjp hjp 96M Jun 10 10:00 EO_EDITIONS_10062020095813917.csv

Und mit absolutem Pfad funktioniert es auch:

trintignant:~/tmp 13:32 :-) 1018% rsync -av EO107csv/ --link-dest=$PWD/a/ c/
sending incremental file list
created directory c

sent 175 bytes  received 36 bytes  422.00 bytes/sec
total size is 195,811,939  speedup is 928,018.67
trintignant:~/tmp 13:33 :-) 1020% ll -i c
total 187M
6036618 -rw-r--r-- 2 hjp hjp 46M Jun 10 09:56 EO107_INTERNET_1_10062020095421358.csv
6036619 -rw-r--r-- 2 hjp hjp 46M Jun 10 11:38 EO107_INTERNET_2_10062020113644.csv
6036620 -rw-r--r-- 2 hjp hjp 96M Jun 10 10:00 EO_EDITIONS_10062020095813917.csv