The challenge: I have discovered that at a fairly complex client (multiple locations with multiple machines per location), one of the staff has created directories named Archive on different machines. I'd like to exclude some of these, but not all, from the rsnapshot (they are cruft, and space is not unlimited).

To make the issue clearer, we are using rsyncd (cygwin on windows boxes) on the hosts being backed up, so an rsync command on the "collector" host looks like this:

/usr/local/bin/rsync -rltv --chmod D0770,F0660 --delete --relative --delete-excluded --partial --stats --log-file=/var/log/rsync --human-readable --exclude-from=/obo-offsitepool/wabac/.rsnapshot_excludes /obo-offsitepool/wabac/daily.0/OBO/collected/

so you can see the exclude-from file in there.

That's one rsync command of 26.

The immediate issue is that two locations have the Archive directory at the top of the sending host's tree, so putting /Archive/ in the --exclude-from file will effectively cause both of those (even the one we want to keep) to be deleted from the rshapshot target machine.

An additional issue is that I don't want to accidentally delete other directories named "archive"

What I think I'd prefer to do is (and this is the "will-it-work" part of my question) is have the staff member creating an archive directory (whereever he creates it) to flag it for exclusion by putting in a .cvsignore file in the proper place, with the directory's exclusion pattern in the file. And of course use --cvs-exclude in the rsnapshot.conf file.

I don't know if the .cvsignore file will work in the root of the rsyncd module (for lack of a better description), and I'm reluctant to experiment on a production server with tons of data.

My reading of the man page leads me to suspect that any file or directory matching the pattern in .cvsignore will be excluded (and therefore deleted), regardless of its position in the tree (e.g. "Archive" found 3 branches below the .cvsignore file will also be excluded and deleted).

Thoughts on this (other than the obvious chance for human failure...)?

Does the .cvsignore file get copied into the rsnapshot tree?

Another option appears to be to exclude all directories named "Archive" and have the ones we want to keep renamed to something unique. Unfortunately I don't know enough about the operations of the client to understand what else this course of action might break.

Thanks in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.