Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am curious about how Ubuntu One automatic file sync works under the hood. When I add or change a file in my file manager, how does it know that the change occurred and it needs to sync it? This will likely need a somewhat technical answer.

share|improve this question
    
Wait for a few months. U1 code is going to be open sourced soon. BTW U1 is practically dead. –  Registered User Apr 5 at 4:36
    
My guess is that U1 has a daemon that runs md5 checksums on files and folders and that reacts when an md5 checksum is different. It might even be git behind the scenes. Just guesses here. –  don.joey Apr 5 at 6:18
    
Did you google this? –  don.joey Apr 5 at 6:18
    
@AdityaPatil I think this question is more about the client, rather than the server. And yes, I'm already aware that U1 is being discontinued, which is partially why I'm asking, in case I decide to try my hand at making an alternative. –  Christopher Kyle Horton Apr 5 at 19:25

1 Answer 1

up vote 4 down vote accepted

The Linux kernel supports something called Inotify. Using it, you can tell the kernel to notify you when something happens to a file or folder. So you can do something like "Whenever a new file is placed in this folder, or whenever a file in this folder has been changed, run the following action".

You can be notified when a file is created, read, written to, opened, closed, moved (or renamed), deleted, etc.

I don't know for a fact that this is how Ubuntu One file sync works, but I think it's a good assumption. If you're interested in the techniques, I suggest reading up on Inotify.

share|improve this answer
    
The client is open source, and yes, inotify is how that works on Linux. On MacOS and Windows, there is a layer of abstraction in the client which provides the native file notification information to the client by translation into inotify events. –  dobey Apr 6 at 19:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.