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

Copy monthly/yearly archives from daily #35

Closed
wants to merge 1 commit into from

Conversation

assistcontrol
Copy link
Collaborator

A daily archive is created automatically. If monthly and/or yearly
archives are missing, they are copied from the daily archive:
tarsnap -c -f monthly @@daily

This also ensures that there is always a daily, monthly, and yearly
backup.

The copy operation should be low-resource and very fast. It
requires only reading the entry metadata from the daily archive.

A daily archive is created automatically. If monthly and/or yearly
archives are missing, they are copied from the daily archive:
  `tarsnap -c -f monthly @@daily`

This also ensures that there is always a daily, monthly, and yearly
backup.

The copy operation should be low-resource and very fast. It
requires only reading the entry metadata from the daily archive.
# No yearly backup
log_debug "message=\"Copying daily archive to yearly archive\""
archive_starttime=$(date +%s)
log_verbose "copy-start type=yearly dir=/$dir name=$yearlyarchive"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the copy process is relatively quick, are the copy-start messages needed? There will always be either a copy-error or copy-finish message

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I threw them in for consistency with the archive operation, but I am always a fan of simpler output. I’ll happily take them out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copy time scales with the number of files in the archive, not the size of the archive. For archives with a huge number of files, the copy time will be less than the backup time, but still noticeable.

assistcontrol added a commit that referenced this pull request Jun 15, 2019
Previously, the first day of the year would create a yearly archive,
the second day would create a monthly, and the third would create a
daily archive. With this change, yearly, monthly, and daily archives
always exist.

Daily archives are created every time acts is run. If monthly and/or
yearly archives don't exist, the new daily archive is copied to
the other(s).

Copies are based on metadata. That metadata must be read and parsed,
which causes some data transfer. However, that data is quite minimal
and should impose very little cost.

Copies do take some time to run. The time scales with the number of
files in the archive, not with the size of each file. And though
time scales, it scales very slowly. In my tests, copies are faster
than archive creation for all but the smallest archives of 1-5 files.
Copies are substantially faster for large archives.
@assistcontrol assistcontrol deleted the copy_backuplevels branch June 15, 2019 18:37
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

Successfully merging this pull request may close these issues.

2 participants