sync to external drive

Karl Auer kauer at biplane.com.au
Sat Dec 2 03:21:07 UTC 2017


On Fri, 2017-12-01 at 20:32 -0600, Tommy Trussell wrote:
> On Thu, Nov 30, 2017 at 12:06 AM, Gary J. Kirkpatrick <garyartista at gm
> ail.com wrote:
> > Rather overwhelmed with all the responses.  What I am looking for
> > is syncing not just copying, like say Dropbox does.  So the program
> > would make an initial copy and then only add new files or changes
> > to previously copied files.  I have tried a couple of programs
> > mentioned but what they do is make another copy of the entire
> > initial copy.  This is way too slow and unnecessarily stresses the
> > drives involved.

Apologies if I am coming late to this thread ad it's all already been
said but: rsync, with the right options and in fact the default
options, does exactly what you want.

This command:

   rsync -a /local/dir/ somehost:/remote/dir

... will, the first time it is run, put a complete copy of the contents
of /local/dir into /remote/dir on somehost. if you run it again, it
will copy only new and updated stuff.

If you expect new things to appear on the remote end from other sources
that you want synced down to your hard drive, just do this straight
afterwards:

   rsync -a somehost:/remote/dir/ /local/dir

There is a LOT more to rsync (see "man rsync"), but that is its
fundamental purpose.

It works locally too, so if you have an external drive as per the
subject line, mounted on (say) /mnt, then this will sync the contents
of /local/dir to /mnt:

   rsync -a /local/dir/ /mnt

All commands of the top of my hed, so doublecheck before use.

Regards, K.

PS: "-a" means "archive" - recurse, keep symlinks, device file and
special files, keep modification time, permissions, group and owner
information.
 
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389

GPG fingerprint: A52E F6B9 708B 51C4 85E6 1634 0571 ADF9 3C1C 6A3A
Old fingerprint: E00D 64ED 9C6A 8605 21E0 0ED0 EE64 2BEE CBCB C38B






More information about the ubuntu-users mailing list