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 think that the time is ripe to have my whole Ubuntu synchronized just as my Dropbox folder is.

Given that we are always talking about files and directories, what's the difference between my Documents folder and my /usr system directory? Almost none, except for their location.

In fact, I think that there is just one big issue that prevents people to have their beloved installations mirrored wherever they go: symlinks.

Dropbox, Google Drive, Ubuntu One, Sugarsync, Skydrive, none of these services support symlinking. This means that if I push a symlink in one of the synced folders, locally the symlink is kept as is, but remotely (in the cloud or on the other synced machines) the symlink is resolved to the actual file that was originally pointed to.

This completely disrupts Linux installations, thus these services can't be used for this purpose.

So the question is: Does anybody knows a way to achieve a completely synchronized Ubuntu, always synchronized with a remote running copy, but still locally stored on both disks?

My best guess is that I could use NFS. But the main difference between Dropbox and NFS is that NFS is a remote filesystem that always forces to remotely access the files, while Dropbox pushes modifications to local filesystems (and thus would perform better). I've also heard about NFS caching. Does anybody knows if this solution could approximate Dropbox in this sense?

P.s. I know that /boot, /dev, /proc, /run, /tmp and device-specific mount points in /mnt and /media will have to be left out the sync mechanism. What I'm interested in is the principle. Can this be done with reasonable performance, having reasonable resources (e.g. ~ 1Mbps upload bandwidth and a public IP address)?

share|improve this question
2  
The remote services you talk about also have no real concept of permissions between multiple users. In short they're completely useless for something like this. –  Oli Oct 11 '12 at 10:13
    
You're right. Another thing to keep in mind. –  Avio Oct 11 '12 at 10:58

2 Answers 2

http://www.howtoforge.com/setting-up-unison-file-synchronization-between-two-servers-on-ubuntu-11.10

This tutorial shows how to set up file synchronization between two Ubuntu 11.10 servers with Unison. Unison is a file-synchronization tool similar to rsync, but the big difference is that it tracks/synchronizes changes in both directions, i.e., files changed on server1 will be replicated to server2 and vice versa.

share|improve this answer
    
Very nice tool! I have to try it! –  Avio Oct 11 '12 at 14:50

My inclination is that you are opening a bit of a pandora's box here.

  • How do you deal with different architectures? Some parts of the filesystem consistently include the architecture as part of the path (/usr/lib/x86_64-linux-gnu and friends), but I don't think this applies everywhere, and in any case you then have to determine which symlinks (and hardlinks) should be copied, and which are architecture specific.

  • How do you detect when significant files are changed? Should a program be restarted if the binary is replaced, or configuration files updated? Some will detect such changes with inotify, some not. If you are just synchronising files while the system is running, it is hard to know what running processes might be affected. (You could look in the apt file lists, or at open file descriptors, but there will still be edge cases). (Consider what happens if your sync mechanism replaced libc or something similar).

I am inclined to think remote management (eg, using puppet or Ubuntu's apt synchronisation mechanism) is more appropriate than continuous synchronisation of the whole machine image.

You should probably include /var in files not to sync (merged logs from multiple systems seems to make little sense).

share|improve this answer
    
Ok, for the point 1, I don't consider it a problem, at least in an initial phase. Sync'ed Ubuntus will be x86-generic or (exclusive or) amd64-generic, so no need to worry about missing modules and so on. For the point 2, the beauty of Linux (unlike Windows) is that you can "pull the rug out" from under applications' feet and what is in memory keeps running as nothing changed. However you are right to say that libc and other few critical files should be handled with care. –  Avio Oct 11 '12 at 11:16
    
apt shouldn't be a huge problem. It already has its lock. Maybe it's sufficient to keep everything locked until the sync is complete, and only then remove the lock. At least some piece of /var has to be synced obligatorily. Without a fully up to date /var/lib/dpkg (or worst a corrupted one) you stop having an Ubuntu and start having a Slackware. –  Avio Oct 11 '12 at 11:18

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.