Hacker News new | ask | show | jobs
by cliveowen 4640 days ago
I always found myself looking for a simple way to backup a hierarchy of folders on an external device and then keep keep both copies synced, then I heard about rsync and discovered that it does just that. Being using it exclusively for all of my backups, really useful.

EDIT: Also since we're talking about rsync, do you think the following options are sufficient for syncing a folder hierarchy from the local disk to an external flash drive?

rsync -aW --delete /source /destination

My main concern is the W option, which skips the usual compression (that delays a lot the already long process of syncing) and might end up writing a lot of bytes and decaying the memory cells of flash storage.

3 comments

You might enjoy checking out rsnapshot[1], which is a convenient way to store backups as snapshots. It of course uses rsync. I've been using it for several years now, and it's saved my ass on more than one occasion.

Note that I haven't touched the configuration since I set it up. It's really great.

[1] - http://www.rsnapshot.org

Depending on OS, you might consider:

    rsync -aSH --delete --update /source/ /destination
if both file-systems are Unix/Linux.

-S Sparse files remain sparse.

-H Hard links are preserved. Caveat: Big O(inodes).

Note the trailing slash on /source/ unless you want to copy to /destination/source/.

-W does not seem like a win for your local-to-local use case but may be the default:

http://rsync.samba.org/ftp/rsync/rsync.html

And if you ever need a two-way sync (ie files on both hosts might change, and propagation to the other host is desired), look at unison.
I've given unison a lot of chances over the years, but I keep going back to rsync with "inbox" and "outbox" directories (if that can be done), or [le]git push/pull/sync if not.

unison is very slow compared to rsync. version at both ends must match (which means you'll likely need to compile your own unless all your machines run the same distro and version).