Document sync / backup

I've been looking for solution for this, but as yet I have not found one.

I use a laptop, and my documents are kept in a folder called Documents.
I am often connected to a network, where there is a server available on which I can dump my documents (via smb or ssh). I can then access these documents over the internet. It also acts as redundancy,
I also have a USB key which is (just) big enough to fit my documents.

I would like to be able to synchronise each of these three folders. I sometimes update the documents on my USB disk or the file server from other computers, so the synchronisation must copy the updated documents to my hard disk.

I was investigating using rsync to synchronise the documents, but it seems to replace any updated documents with the originals. I also (briefly) tried to drsync, but could not get it to work.

What are your opinions on the best software for this purpose? It preferably needs to be easy (eg. executable from a script-one step) and efficient (cp -a is not what i had in mind).

Rsync is certainly efficient, but have I overlooked a way to configure it properly (i.e. not to replace newer files). Are there other solutions?

0

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

rsync option

-u, --update skip files that are newer on the receiver

rsync is a good way to go. Above is an option you may have missed, listed in the man page. To be safe, I'd always make sure to update the local copy on your laptop before editting things anew.

Supporting edits from multiple working copies requires a version control system like cvs or subversion. That's a lot more involved than using rsync. As long as you remember to update your local copy before making new changes, rsync should work fine, and throwing in the above -u option may help prevent you from accidently overwriting a newer file. However, if you have multiple users wanting to make updates, than a version control system is probably essential.

unison

I suggest unison. There's even a GTK frontend: unison-gtk.

Quoting http://www.cis.upenn.edu/~bcpierce/unison/:

Unlike simple mirroring or backup utilities, Unison can deal with updates to both replicas of a distributed directory structure. Updates that do not conflict are propagated automatically. Conflicting updates are detected and displayed.

Cheers, Georg

Consider using version control (SVN) instead

I had this problem for a long time. As a programmer, I started using version control to manage my code. Then, I decided to use it for managing my documents, too.

I suggest that you use subversion.

You will need an accessible machine to act as your svn repository. I use a private virtual server on the internet (VPS) running Debian (of course).

So you would import the updated Documents folder into a new repository. Then, you must check it out in all the places you need it: your USB key, your work and home machines, etc. I check out my documents with:

svn co svn+ssh://my-svn-server.com/svn/documents

After you add, delete, or modify a file, you check in the change with subversion:

svn ci -m "made changes for client" document.doc

Or if you are lazy:

svn ci -m "changes for today"

(does all docs in current dir and below)

To keep your Document directories in sync (laptop, key, etc) , just run "svn up" in the folder and it will be current. No jobs to schedule, no guessing if something is up to date.

Using this system, I also have live backup happening. If I screw up a file, I can 'svn restore' it. And if I want to see what I changed, I can 'svn diff' the file.

All of my checkouts and submits happen quickly over the network, and everything is secure with ssh. You may want to set up ssh keys with ssh-agent to make life easier. Or you could have your repository accessible over https with login/password auth.

Svn works on almost every platform. On windows and OSX you can install fancy GUI front-ends, so you can use the mouse to perform svn operations.

I believe version control (and especially subversion) is really the best way to manage any set of related documents -- be it a web site, application code, personal documents, etc.

The only downside is that you will need a remotly accessible server, with good security and network speed, and enough disk space to hold all your important documents + changes. But you get a lot of satisfaction knowing the status of every file.

i miss subversion

I considered using subversion, and in a perfect world, i would.
Unfortunately there is a rather strict disk quote on the local network server (300mb!). I could just create a repository locally, and checkout to the server, my document, jumpdisk, but sadly my harddisk is similarly limited for space, and i need it for my occasional kernel compile etc.

I set up svn for a website that I maintain just a few days ago, and it works beautifully. Though for my (openoffice) documents, it would be nice if it could unzip and diff the xml, at least to show you the changes, maybe even merge.

Rsync is working nicely at the moment. Only thing i would like to improve is being able to delete files. if I delete a file in my documents, it will propagate back when I sync again. So i have to delete each document up to three times.

I miss 'svn delete' already

--delete option

It will delete files on the receiving end.

--delete may not be an option

As far as I know, this will also delete new files on the recieving end too, so I could potentially lose work.

Now if it could see whether a file had been modified since the last sync, delete it if it was older (and not present on the source), then that might potentially work.
I don't know if rsync supports this amount of complexity.

Syndicate content