Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better versioning in backup #647

Open
danmcne opened this issue Oct 1, 2024 · 0 comments
Open

Better versioning in backup #647

danmcne opened this issue Oct 1, 2024 · 0 comments

Comments

@danmcne
Copy link

danmcne commented Oct 1, 2024

I want to to back up files without losing older versions ... one way to do that is the following:
rsync -avz --checksum --backup --backup-dir="older_versions" --suffix="~$(date +%Y-%m-%d)" "$SOURCE_DIR/" "$DEST_DIR/"

This moves the older file to an "older_versions" directory with a suffix consisting of the current date.

But what if one backs up more than once in one day? One could append the hour, minute and second as well, but a better way might be to append a UUID or hash (or the first 8 characters of one) to the backed up version.

Unfortunately rsync doesn't seem to have access to a file's checksum to use in naming (though it can use it to compare files) and it can't call uuidgen for each file. Something like the following only generates the uuid when rsync is called and then appends the same characters to every old version:

rsync -avz --checksum --backup --backup-dir="older_versions" --suffix="~$(date +%Y-%m-%d)-$(uuidgen | cut -c1-8)" "$SOURCE_DIR/" "$DEST_DIR/"

It would be great to have stronger versioning that allowed one to append different uuids to each old version file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant