Clear all .checkpoints in a Borg Repo

Clear all .checkpoints in a Borg Repo

Checkpoints are made every 5 minutes by default so that if the backup is interrupted, most of you’ve uploaded so far is still up there.

From the creator of Borg:

9:54 PM (ThomasWaldmann) if a backup is interrupted, borg will leave a .checkpoint archive behind.
9:54 PM (ThomasWaldmann) it makes these archives every , default is 5 minutes
9:55 PM (ThomasWaldmann) these archives reference all chunks that were transmitted up to its creation time.
9:56 PM (ThomasWaldmann) so, if you want to continue, you just issue the same backup command again and it will notice that some of the chunks are already in the repo and won’t retransmit them.
9:56 PM (ThomasWaldmann) if it is interrupted again, repeat issuing the backup command until it completes.
9:57 PM (ThomasWaldmann) AFTER that, you can remove the related .checkpoint archives (the chunks will then be references be the completed archive).
9:57 PM (ThomasWaldmann) referenced by

9:57 PM (ThomasWaldmann) but do not delete the checkpoint before completing or it will have to retransmit all these chunks.

2:03 AM (ThomasWaldmann) if you did not want ALL the files in the checkpoint, you can delete it at any time.
2:04 AM (ThomasWaldmann) but if there are a lot of wanted files in the checkpoint, first finish the backup and then delete the checkpoint.
2:05 AM (ThomasWaldmann) borg does reference counting, so if you remove all references to some chunk, the chunk will get removed.
2:05 AM (ThomasWaldmann) so if some files/chunks are only in 1 archive / checkpoint and you delete that, it will remove these files/chunks from the repo.

$REPO is the location of your Borg backup repository, for me this is borg:borg-repo/
First list all .checkpoint archives:

borg list "$REPO" | grep ".checkpoint" | cut -d' ' -f1

We need to use --jobs 1 with parallel as borg locks when deleting things, so we do it one at a time.

borg list "$REPO" | grep ".checkpoint" | cut -d' ' -f1 | parallel --jobs 1 borg delete "$REPO::{}"

We can check again to see the repos left: borg list "$REPO"

Leave a Reply

Your email address will not be published. Required fields are marked *