2

I want to have rsnapshot backup a local on-disk SVN repository on a Linux machine. I know I can't just back it up off the file system, so before each snapshot I am making a copy with 'svnadmin hotcopy'. However, every time I do a hotcopy, the resulting files all have a current timestamp, rather than the same timestamp as the original file. This means I lose the ability to do the copy-on-write-esque disk space saving that rsnapshot gives.

One solution I have thought of is to have a script look at all the files in the hotcopy ($DEST) and for each file x, set the timestamp based on the file $SOURCE/x. I don't know if there is a way to make rsync do this on Linux (I know you can do it in Robocopy on Windows :) I'm sure it can be done with find and touch however.

Suggestions how to do this, or other solutions, welcomed. I'd rather not use incremental svn dumps, as I want each point-in-time snapshot to be a full copy of the repository at that time.

crb
  • 8,132
  • 6
  • 37
  • 48

1 Answers1

0

Turns out changing the timestamps on all the files wasn't that difficult:

cd /var/local/backup/svn
find . -exec touch -r /data/src/svn/\{\} \{\} \;

This will ensure that the timestamps on files that exist in the hot-copy backup have the same timestamp as their parent, meaning they should only be updated when you update the original.

crb
  • 8,132
  • 6
  • 37
  • 48
  • 1
    That sounds dangerous. If someone makes changes to the repository between doing `svnadmin hotcopy` and doing the `touch`, then the files' timestamps won't accurately represent their contents. So on a future backup, you could fail to copy a file that should have been copied. – Craig McQueen Feb 08 '10 at 23:55
  • As we are doing a rolling copy every 4 hours, on a very low traffic repository, I don't think this is a major concern; but I agree with you, this is a kludge, and being able to correctly set the timestamps during the hotcopy is by far a better solution. – crb Feb 09 '10 at 09:58