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

Temporary backup name #189

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SimonHeimberg
Copy link
Contributor

advantages of temporary backup name:

  • script knows easy which backups are complete
    => no danger to try to resume a completed backup
    => lock can be set early without problems
  • user sees easy which backups are complete

setting the lock early prevents concurrent backups more reliable

@SimonHeimberg
Copy link
Contributor Author

I currently have some backups which are empty. Reason to find. If the backup name would be temporarely, I would have recognized the problem easier.

@@ -613,8 +610,9 @@ while : ; do
# Add symlink to last backup
# -----------------------------------------------------------------------------

fn_run_cmd "mv -- '$DEST' '$DEST_DONE'"

Choose a reason for hiding this comment

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

this use of mv can be dangerous on some systems (like on tape backups; yes these are really still used in the wild as they are very cheap and long lasting)
it might be safer (as these are backups after all) to use a conflict check or -f (force) flag to ensure backups make it when they have to overwrite partial or corrupt copies from previous runs.

also have you tested what happened with symlink conflicts?

Copy link
Contributor Author

@SimonHeimberg SimonHeimberg Mar 21, 2020

Choose a reason for hiding this comment

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

I just used the same arguments for mv it was used before (when continuing an aborted backup) (L485).
I see that mv -T (or with long option mv --no-target-directory) is safer than plain mv. With -f, it only overwrites empty directories, but does never move the directory to somewhere unexpected. Or what symlink conflict do you mean?

The porpose of this mv is to mark the backup as completed. It should not overwrite any data (except in very strange or constructed cases).

I do not know enough about tape backups. Can they be used with current version? How does rsync decide if a hardlink should be created without rewinding? By caching data?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

any reply @reactive-firewall ?

fi
# update PID to current process to avoid multiple concurrent resumes
fn_run_cmd "echo $MYPID > $INPROGRESS_FILE"
fn_run_cmd "mv -- $PREVIOUS_DEST_RUNNING $DEST"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This mv moves the incomplete backup to the new name, to resume. It is the same as before except of the temporary name.

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