2
1
I'm testing rsync with WebDAV server in Docker container:
- local directory: /Users/user/files/
- "remote" mounted server: /Volumes/webdav/
Here's the initial state:
# remote
➜ cat /Volumes/webdav/remotefile
change
➜ ls -la /Volumes/webdav/remotefile
-rwx------ 1 user staff 7 Dec 2 01:39 /Volumes/webdav/remotefile
# local
➜ cat /Users/user/files/remotefile
change
➜ ls -la /Users/user/files/remotefile
-rwx------ 1 user staff 7 Dec 2 01:39 /Users/user/files/remotefile
Now let's change local file and upload it to "remote" server:
➜ files echo 'add#0' > ./remotefile
➜ files cat remotefile
add#0
➜ files \rsync -varP /Users/user/files/* /Volumes/webdav/ --delete
building file list ...
1 file to consider
remotefile
6 100% 0.00kB/s 0:00:00 (xfer#1, to-check=0/1)
sent 132 bytes received 42 bytes 348.00 bytes/sec
total size is 6 speedup is 0.03
File uploads successfully, as it was changed. But if I run rsync again local => remote, it re-uploads it:
➜ files \rsync -varP /Users/user/files/* /Volumes/webdav/ --delete
building file list ...
1 file to consider
remotefile
6 100% 0.00kB/s 0:00:00 (xfer#1, to-check=0/1)
sent 132 bytes received 42 bytes 348.00 bytes/sec
total size is 6 speedup is 0.03
Now I test opposite direction:
➜ files \rsync -varP /Volumes/webdav/* /Users/user/files/ --delete
building file list ...
1 file to consider
remotefile
6 100% 0.00kB/s 0:00:00 (xfer#1, to-check=0/1)
sent 132 bytes received 42 bytes 348.00 bytes/sec
total size is 6 speedup is 0.03
File downloads succesfully. And one more time...
➜ files \rsync -varP /Volumes/webdav/* /Users/user/files/ --delete
building file list ...
1 file to consider
sent 80 bytes received 20 bytes 200.00 bytes/sec
total size is 6 speedup is 0.06
...shows 0 transfers, as file was not changed. Thats the expected behavour.
Why it doesn't work with local => remote upload and always re-uploads file?
Thanks.
Brilliant guess!
date && docker exec 1c3f5cb52a55 date => Fri Dec 2 02:18:09 MSK 2016 Thu Dec 1 23:18:09 UTC 2016
– f1nn – 2016-12-01T23:20:43.477--size-only
works as expected, but if only file symbol in file changed, it obviously considered file was not changed. – f1nn – 2016-12-01T23:22:14.473Unfortunately, I can't control remote server time as it's third-party webdav server. size-only is unreliable. Are there any workarounds? For example, how Dropbox solves similar problems? I suppose they should use similar algorithm. – f1nn – 2016-12-01T23:24:35.937
Moscow Standard Time (MSK) is UTC +3, which makes me think the clocks are in sync. Maybe something else is at play here. – StandardEyre – 2016-12-01T23:31:41.243
Ah, I've got you. Rsync respects TZ shifts, so the time is technically the same. Right now I'm playing with
--checksum
option, and it seems to work at first look. But not sure, how it will work with remote 50GB server with millions of files. Thanks for pointing out direction. – f1nn – 2016-12-01T23:38:08.757