Noob help with backup command syntax

Paul Slootman paul at debian.org
Fri Sep 23 09:44:59 GMT 2005


On Thu 22 Sep 2005, scott.list wrote:
> 
> Can someone show me the syntax for doing the following:?
> 
> Given:
> 
> localserver = server that has data I want backed up, and I'm logged in
> as root on it
> remoteserver = server where the data is to go, into it's
> /home/testuser/backup directory.
> 
> I understood the examples and basics of getting one file, can someone
> tell me how to backup a list of files, and a list of directories, some
> directories with specific files.
> 
> as in
> 
> /etc/named/*
> /etc/some.conf
> /home/bill/*
> /home/james/somedocument

The most simple way would be to run a separate rsync for each source:

rsync -aH /etc/named     remoteserver:/home/testuser/backup/etc/
rsync -aH /etc/some.conf remoteserver:/home/testuser/backup/etc/
rsync -aH /home/bill     remoteserver:/home/testuser/backup/home/
rsync -aH /home/james/somedocument remoteserver:/home/testuser/backup/home/james/

(The -a option basically preserves all attributes except for hard links;
those are handled with the -H option. That's not included in -a as it
has a higher overhead.)

The first two could be combined as the destination dir is the same;
to combine the rest you have to do things with --relative, which
might make things more confusing if you're not familiar with rsync:

rsync -aH --relative /etc/named /etc/some.conf /home/bill /home/james/somedocument remoteserver:/home/testuser/backup/

> Ideally, a file where I could place a list of what I wanted to rsync
> would be nice.

For that, there's the --files-from option, the list could be generated
with e.g. find.


Paul Slootman


More information about the rsync mailing list