0

I sync files on a few different devices with a remote ssh server using rsync. The problem is that I sometimes forget to sync a device on which I've modified a file and this makes things complicated. My first question is how to make syncing automatic in Ubuntu, I mean syncing when a file is modified but not "too often" (like when I'm working on a text file.)

Now a problem with automatic syncing is that if I screw up a file on one device it can propagate to others (and I may not even realize it when I delete a file by mistake). So I'd like to have backups on the remote server. Sometime ago I used the backup option in rsync but then the backed up files were synced back and forth and it created a mess. How can I have backups of the old files on the remote server without them being sent back to local devices? Is there any way to control how many back ups of each file are kept?

1

You can have several backups when you use the rsync option --link-dest.

rsync will create another directory with your backup tree, hardlink the files that didn't change, and only copy the changed files. That way you don't use twice the space. For excample:

rsync -a --delete --link-dest=../previous_backup source_directory/  backup

You have to use a filesystem that supports hard links for this to work, ext4 works fine.

I have used an NTFS removable disk in the past, but the filesystem had a big performance hit: a 130 GB backup with around 15 previous backups would take more than 80 minutes to complete. After I have moved the entire tree to an ext4 partition (on the same disk), the subsequent backups would take around 2 minutes to complete.

I have adapted the scripts from this page for my needs:

http://www.mikerubel.org/computers/rsync_snapshots/

| improve this answer | |
0

I would advise to split backup and sync. Use for example rsnapshot for your backups and lsync, owncloud, git or rsync (depending on needs and situation) for syncing the data to work on them.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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