Conversation
|
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. |
| # Add symlink to last backup | ||
| # ----------------------------------------------------------------------------- | ||
|
|
||
| fn_run_cmd "mv -- '$DEST' '$DEST_DONE'" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
| 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" |
There was a problem hiding this comment.
This mv moves the incomplete backup to the new name, to resume. It is the same as before except of the temporary name.
advantages of temporary backup name:
=> no danger to try to resume a completed backup
=> lock can be set early without problems
setting the lock early prevents concurrent backups more reliable