Greetings rsync gurus!
I'm trying to run rsync from machine A to backup files on machine B.
I want the files to be copied into a directory -- /backups/B -- on machine
A and mimic the directory structure on machine B.
Machine B has the following file systems (and some NFS mounts I don't
want):
/
/boot
/usr
/usr/local
/usr/local/apache
The problem comes when I run rsync with --one-file-system against the /usr
file system on the remote machine. Rsync deletes all the files in and
below /backups/B/usr/local on A as it rsyncs B:/usr
I think I can work around this behavior by tuning the --exclude= pattern
when I rsync against /usr/local and /usr/local/apache, but I was wondering
if there is a better way.
* Is there a way for --one-file-system to know on dest side not to delete
files that are not part of the target file system on the src side?
Example commands and details:
First step works okay, backs up B:/ to A:/backups/B
rsync -av -e ssh --one-file-system --numeric-ids --relative --delete \
--exclude-from=/backups/control/all.exclude root@B:/ .
This is where it stops working as desired, rsync deletes everything under
/backups/BB/usr/local on A while trying to rsync /usr from B --
rsync -av -e ssh --one-file-system --numeric-ids --relative --delete \
--exclude-from=/backups/control/all.exclude root@B:/usr .
This also doesn't work as desired, it deletes everything under
/backups/B/usr/local/apache --
rsync -av -e ssh --one-file-system --numeric-ids --relative --delete \
--exclude-from=/backups/control/all.exclude root@B:/usr/local .
Finally, this works fine, it is the deepest file system on B:
rsync -av -e ssh --one-file-system --numeric-ids --relative --delete \
--exclude-from=/backups/control/all.exclude root@B:/usr/local/apache .
I've tried fiddling with trailing slashes on the src spec, tried w/wo
--relative, and modifying the dest spec. I was not able to achieve the
result I wanted and I'm pretty sure it's because the files on the remote
side are not part of the remote file system but they are part of the dest
file system and so are deleted by rsync.
I'd much rather do this in a "pull" configuration similar to the
commands
given above than "pushing" the files... if possible.
Any ideas? Did I miss something simple? (I hope not! :-)
-Brian