On 03/08/2019 07.41, Andrei Borzenkov wrote:
02.08.2019 22:24, Carlos E. R. пишет:
...
rsync $OPTIONS --password-file /root/cripta/keys/rsync.secrets \ --include /data/storage_** --include=/data/vmware \ --exclude=/lost+found --exclude=/dev --exclude=/sys --exclude=/proc --exclude=/run \ --exclude=/data/** --exclude=/mnt --exclude=/other --exclude=/media --exclude=/var/lib/samba/lock/ --exclude=/var/run/ \ / root@Isengard::MyBook_Telcontar/$DESTINO
The problem is that it is creating: /mnt/BookTelcontar/001/storage_b, /mnt/BookTelcontar/001/storage_c, instead of /mnt/BookTelcontar/001/data/storage_b, /mnt/BookTelcontar/001/storage_a.
:-(
I cannot reproduce it. rsync sends paths relative to source directory by default and you have single source directory which is /:
bor@bor-Latitude-E5450:~$ LC_ALL=C find /tmp/root/ /tmp/root/ /tmp/root/foo /tmp/root/data /tmp/root/data/copy /tmp/root/data/copy/foo /tmp/root/data/copy/bar /tmp/root/data/skip /tmp/root/data/skip/baz bor@bor-Latitude-E5450:~$ LC_ALL=C rsync -av --include /data/copy** --exclude /data/** --exclude /foo* /tmp/root/ /tmp/newroot/ sending incremental file list ./ data/ data/copy/ data/copy/bar data/copy/foo
sent 232 bytes received 69 bytes 602.00 bytes/sec total size is 0 speedup is 0.00 bor@bor-Latitude-E5450:~$ LC_ALL=C find /tmp/newroot/ /tmp/newroot/ /tmp/newroot/data /tmp/newroot/data/copy /tmp/newroot/data/copy/foo /tmp/newroot/data/copy/bar bor@bor-Latitude-E5450:~$
You may try --relative which send full paths; as your source is filesystem root anyway, it should do what you want.
Oh, I believe I understand what happens - shell expands your /data/storage_* so rsync (quite correctly) sends paths relative to *new* root which is /data in this case.
I used "ps afx | grep rsync" to find out if this was happening, but the shell does not expand "--include /data/storage_*". It is in one of the posts I sent. I may test again - it is becoming difficult (slow) as there are 4TB to copy. I'll create a test tree and try then. But I have a working method, which is call rsync twice: echo "---> main part." rsync $OPTIONS --password-file /root/cripta/keys/rsync.secrets \ --exclude=/lost+found --exclude=/dev --exclude=/sys --exclude=/proc --exclude=/run \ --exclude=/data/** --exclude=/mnt --exclude=/other --exclude=/media --exclude=/var/lib/samba/lock/ --exclude=/var/run/ \ / root@Isengard::MyBook_Telcontar/$DESTINO echo echo "---> /data part." echo rsync $OPTIONS --password-file /root/cripta/keys/rsync.secrets \ --exclude=/lost+found --exclude=/dev --exclude=/sys --exclude=/proc --exclude=/run \ --exclude=/mnt --exclude=/other --exclude=/media --exclude=/var/lib/samba/lock/ --exclude=/var/run/ \ /data/vmware /data/cripta /data/xtr /data/raid /data/storage_** \ root@Isengard::MyBook_Telcontar/$DESTINO/data It is not that neat, but it works. Or I could instead exclude one by one the directories in /data that I do not want, that would work. -- Cheers / Saludos, Carlos E. R. (from 15.0 x86_64 at Telcontar)