I am syncing a local directory (say "/local") with a cloud storage server using Unison. The cloud storage is mounted to, say, "/mnt" via sshfs (with no-cache option), and I sync the two directories /local and /mnt with Unison locally. [I don't have root access to the server, and Unison is not installed on the server, so a genuine remote sync with Unison is not possible.]
In short, I am looking for a safe way to sync the local directories of multiple computers with the server (including the correct handling of removed files).
I assume that the Unison sync between local directories is safe in principle, as long as nothing happens to the connection. But what if the sshfs connection breaks while Unison is working? Unfortunately I don't understand well enough how sshfs connections work in order to judge whether there is a data loss risk.
Assume Unison is in the process of writing a modified file to /mnt when the connection breaks. Will it quit with an error (which I assume would be safe)? My fear is that it keeps writing to /mnt although the connection is broken, and then marks a file as successfully transferred in its archive although the file has not actually been written to the server. Could this happen?
How about read processes? It seems that when I disconnect while Unison is reading /mnt it always fails with the error message that /mnt has been emptied completely (good!). But is there any situation in which it might get the information that only part of the data in /mnt is missing and then wrongly assumes that these files have been deleted?
EDIT: Reading the Unison manual again, I got aware of the "mountpoint" parameter. However, the way the manual makes it sound, Unison checks for the existence of the mountpoint only once, after detecting updates. So I still see the risk of something going wrong if the connection breaks during file transfer.
EDIT2: Essentially, my question is the same as this - seemingly unanswered - question in the fuse sourceforge mailing list: https://sourceforge.net/p/fuse/mailman/message/1605382/
0 Answers