[TUTORIAL] How-to: Delete all unencrypted backups

dekiesel

Member
Apr 30, 2023
95
16
13
Hi,

I've unfortunately not encrypted my earliest backups and after doing so I realized that the GUI doesn't offer a way to bulk-select backups.

After searching the forum for a while I found workpush's script that bulk deletes unverified backups, so 99% of the credit goes to him.

This script deletes all unencrypted backups in a datastore:

Bash:
#!/bin/bash

REPO="YourRepo"


# List failed snapshots in the given backup group and delete them
proxmox-backup-client snapshot list \
  --repository "$REPO" --output-format json |
  jq -r '
    .[]|select(any(.files[]; ."crypt-mode"=="none"?))
    | .["backup-type"] + "/" + .["backup-id"] + "/" + ( .["backup-time"] | strftime("%Y-%m-%dT%H:%M:%SZ") )
  '|
  while IFS= read -r SNAPSHOT; do
    echo "Deleting snapshot: $SNAPSHOT"
    proxmox-backup-client snapshot forget "$SNAPSHOT" --repository "$REPO"
done

 

Attachments

  • 1772436782112.png
    1772436782112.png
    82.4 KB · Views: 2
  • Like
Reactions: Johannes S and UdoB