I have recently setup a new Duplicity backup system, and while this works nicely, I noticed Duplicity wasn’t deleting old backups from Amazon S3, despite the backup script running remove-all-but-n-full 2 every 12 hours.

This was a bit confusing as the Duplicity documentation makes out that this command will remove all backups except for the last 2 full backups.

After some Googling, I came across the cleanup command. While I had already added this to the script, it was under an option intended for manual use, as the documentation makes out that this should only really be run if a session fails or is aborted.

I also discovered that cleanup takes an --extra-clean argument. This made all the difference! I added cleanup --extra-clean --force to my 12-hour section of code, and finally Duplicity was removing extraneous files from S3!

I hope this helps if you’re in a similar situation 😄