problems with telling rsync what to delete
erik at toltech.nl
Tue May 31 16:56:48 GMT 2005
I'm a system manager using rsync 2.6.3 to run backups.
One of the main requirements is that the data is GPG encrypted before it
is sent to the remote host (and stays encrypted there).
As it is impossible to encrypt the entire system (which could be well
over 10GB) I built a small script to determine which files were
modified, unchanged and removed.
It does this by generating an md5sum list of all files and comparing
that to the one created on the previous backup.
When I know what files changed and were new, I built a temprorary
directory, build the directory structure there, encrypt the files and
put them in this temprorary store.
After that this is synced using rsync. I use the --backup option to keep
a "current" and an incremental directory for each day of the week, so I
can retrieve more than just the last backup.
My problem is in processing deleted files. As the temprorary file store
does not always contain all files (only the changed/new ones are placed
in the store, to save disk space) rsync thinks that these files were
deleted, and deletes them from the "current" tree on the remote host.
They are ofcourse saved in the incremental directory after that, but the
idea is that the current tree is always a correct copy of the current
I can ofcourse disable the deletion of files, but I do need to delete
files that were actually deleted on the source host.
In the manual I read that when using --delete-after rsync would not
delete files in the excluded files list, even if they were not placed in
the source directory anymore. For some reason this does not appear to
work for me.
The exclude file list has filenames that are relative to the source
directory supplied to rsync, so that would be correct.
The line I use to run rsync: /usr/bin/rsync --rsh=ssh -p -o
--delete-after --recursive --links --times --compress --verbose --stats
--backup --backup-dir=/home/erik/day-of-the-week --timeout=36000
--exclude-from=unchanged_files_list /home/erik/temprorary_encrypted_store erik at remotehost:/home/erik/current
Does anyone know what may be wrong with that?
Another solution for me may be to disable deletion at first and then run
another rsync session where I tell rsync: delete these files (aka move
them into the incremental directory for today).
Ofcourse it would be possible to write such a script myself (not using
rsync) but it would be much nicer if I could do it with rsync, which
probably supports these features.
Any suggestion on how to solve this is appreciated :-)
More information about the rsync