×

You can delete a backup by creating the DeleteBackupRequest custom resource (CR) or by running the velero backup delete command as explained in the following procedures.

The volume backup artifacts are deleted at different times depending on the backup method:

  • Restic: The artifacts are deleted in the next full maintenance cycle, after the backup is deleted.

  • Container Storage Interface (CSI): The artifacts are deleted immediately when the backup is deleted.

  • Kopia: The artifacts are deleted after three full maintenance cycles of the Kopia repository, after the backup is deleted.

Deleting a backup by creating a DeleteBackupRequest CR

You can delete a backup by creating a DeleteBackupRequest custom resource (CR).

Prerequisites
  • You have run a backup of your application.

Procedure
  1. Create a DeleteBackupRequest CR manifest file:

    apiVersion: velero.io/v1
    kind: DeleteBackupRequest
    metadata:
      name: deletebackuprequest
      namespace: openshift-adp
    spec:
      backupName: <backup_name> (1)
    1 Specify the name of the backup.
  2. Apply the DeleteBackupRequest CR to delete the backup:

    $ oc apply -f <deletebackuprequest_cr_filename>

Deleting a backup by using the Velero CLI

You can delete a backup by using the Velero CLI.

Prerequisites
  • You have run a backup of your application.

  • You downloaded the Velero CLI and can access the Velero binary in your cluster.

Procedure
  • To delete the backup, run the following Velero command:

    $ velero backup delete <backup_name> -n openshift-adp (1)
    1 Specify the name of the backup.

About Kopia repository maintenance

There are two types of Kopia repository maintenance:

Quick maintenance
  • Runs every hour to keep the number of index blobs (n) low. A high number of indexes negatively affects the performance of Kopia operations.

  • Does not delete any metadata from the repository without ensuring that another copy of the same metadata exists.

Full maintenance
  • Runs every 24 hours to perform garbage collection of repository contents that are no longer needed.

  • snapshot-gc, a full maintenance task, finds all files and directory listings that are no longer accessible from snapshot manifests and marks them as deleted.

  • A full maintenance is a resource-costly operation, as it requires scanning all directories in all snapshots that are active in the cluster.

Kopia maintenance in OADP

The repo-maintain-job jobs are executed in the namespace where OADP is installed, as shown in the following example:

pod/repo-maintain-job-173...2527-2nbls                             0/1     Completed   0          168m
pod/repo-maintain-job-173....536-fl9tm                             0/1     Completed   0          108m
pod/repo-maintain-job-173...2545-55ggx                             0/1     Completed   0          48m

You can check the logs of the repo-maintain-job for more details about the cleanup and the removal of artifacts in the backup object storage. You can find a note, as shown in the following example, in the repo-maintain-job when the next full cycle maintenance is due:

not due for full maintenance cycle until 2024-00-00 18:29:4

Three successful executions of a full maintenance cycle are required for the objects to be deleted from the backup object storage. This means you can expect up to 72 hours for all the artifacts in the backup object storage to be deleted.

Deleting a backup repository

After you delete the backup, and after the Kopia repository maintenance cycles to delete the related artifacts are complete, the backup is no longer referenced by any metadata or manifest objects. You can then delete the backuprepository custom resource (CR) to complete the backup deletion process.

Prerequisites
  • You have deleted the backup of your application.

  • You have waited up to 72 hours after the backup is deleted. This time frame allows Kopia to run the repository maintenance cycles.

Procedure
  1. To get the name of the backup repository CR for a backup, run the following command:

    $ oc get backuprepositories.velero.io -n openshift-adp
  2. To delete the backup repository CR, run the following command:

    $ oc delete backuprepository <backup_repository_name> -n openshift-adp (1)
    1 Specify the name of the backup repository from the earlier step.