# Unable to delete backup

**URL:** https://forums.percona.com/t/unable-to-delete-backup/17701
**Category:** Percona Backup for MongoDB
**Created:** [September 27, 2022, 12:01pm UTC](https://forums.percona.com/t/unable-to-delete-backup/17701 "2022-09-27T12:01:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![aranjith0](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/aranjith0/32/13012_2.png) [@aranjith0](https://forums.percona.com/u/aranjith0)
#### Post date: [September 27, 2022, 12:01pm UTC](https://forums.percona.com/t/unable-to-delete-backup/17701/1 "2022-09-27T12:01:03Z")

</div>

```auto
[mongod@ip-10-80-10-153 ~]$ pbm status
Cluster:
========
configReplSet:
  - configReplSet/pmgo-pl204.int.compumark.com:27019: pbm-agent v2.0.0 OK
  - configReplSet/pmgo-pl202.int.compumark.com:27019: pbm-agent v2.0.0 OK
  - configReplSet/pmgo-pl206.int.compumark.com:27029: pbm-agent v2.0.0 OK
shard1ReplSet:
  - shard1ReplSet/pmgo-pl203.int.compumark.com:27018: pbm-agent v2.0.0 OK
  - shard1ReplSet/pmgo-pl201.int.compumark.com:27018: pbm-agent v2.0.0 OK
  - shard1ReplSet/pmgo-pl202.int.compumark.com:27028: pbm-agent v2.0.0 OK
shard2ReplSet:
  - shard2ReplSet/pmgo-pl204.int.compumark.com:27018: pbm-agent v2.0.0 OK
  - shard2ReplSet/pmgo-pl202.int.compumark.com:27018: pbm-agent v2.0.0 OK
  - shard2ReplSet/pmgo-pl205.int.compumark.com:27028: pbm-agent v2.0.0 OK
shard3ReplSet:
  - shard3ReplSet/pmgo-pl206.int.compumark.com:27018: pbm-agent v2.0.0 OK
  - shard3ReplSet/pmgo-pl205.int.compumark.com:27018: pbm-agent v2.0.0 OK
  - shard3ReplSet/pmgo-pl201.int.compumark.com:27028: pbm-agent v2.0.0 OK

PITR incremental backup:
========================
Status [ON]

Currently running:
==================
(none)

Backups:
========
S3 us-east-1 s3://cm-mongo-db-shared-prod-va/pbm/backup
  Snapshots:
    2022-09-26T14:47:50Z 1.85TB <logical> [restore_to_time: 2022-09-27T08:00:21Z]
    2022-09-24T01:00:03Z 1.82TB <logical> [restore_to_time: 2022-09-24T18:49:35Z]
    2022-09-17T01:00:02Z 1.81TB <logical> [restore_to_time: 2022-09-17T17:39:11Z]
  PITR chunks [49.95GB]:
    2022-09-24T18:49:36Z - 2022-09-27T11:00:00Z
    2022-09-17T17:39:12Z - 2022-09-18T17:44:51Z
[mongod@ip-10-80-10-153 ~]$ pbm delete-backup 2022-09-17T01:00:02Z
Are you sure you want delete backup(s)? [y/N] y
Waiting for delete to be done ..Error: deleting: unable to delete: backup is a base for '2022-09-17T17:39:11 - 2022-09-18T17:44:51'

[mongod@ip-10-80-10-153 ~]$ pbm delete-pitr --older-than="2022-09-24T18:49:35"
Are you sure you want delete chunks? [y/N] y
Waiting for delete to be done ...[done]
Backup snapshots:
  2022-09-17T01:00:02Z <logical> [restore_to_time: 2022-09-17T17:39:11Z]
  2022-09-24T01:00:03Z <logical> [restore_to_time: 2022-09-24T18:49:35Z]
  2022-09-26T14:47:50Z <logical> [restore_to_time: 2022-09-27T08:00:21Z]

PITR <on>:
  2022-09-17T17:39:12Z - 2022-09-18T17:44:51Z
  2022-09-24T18:49:36Z - 2022-09-27T11:00:00Z

```

```auto
[mongod@ip-10-80-10-153 ~]$ pbm delete-backup 2022-09-17T01:00:02Z
Are you sure you want delete backup(s)? [y/N] y
Waiting for delete to be done ..Error: deleting: unable to delete: backup is a base for '2022-09-17T17:39:11 - 2022-09-18T17:44:51'

```

---

<div class="post-metadata">

### Author: ![Dmytro\_Zghoba](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/dmytro_zghoba/32/4721_2.png) [@Dmytro\_Zghoba](https://forums.percona.com/u/Dmytro_Zghoba)
#### Post date: [September 29, 2022, 6:14am UTC](https://forums.percona.com/t/unable-to-delete-backup/17701/2 "2022-09-29T06:14:28Z")

</div>

Hi @aranjith0,

This is fixed in [[PBM-850] Add ability to delete older backups - Percona JIRA](https://jira.percona.com/browse/PBM-850). Wait for the release.

But right now, you can delete PITR first and the backup after:

```auto
pbm delete-pitr --older-than="2022-09-24T18:49:36Z" # will delete [2022-09-17T17:39:12Z - 2022-09-18T17:44:51Z]
pbm delete-backup "2022-09-17T01:00:02Z"

```

---

<div class="post-metadata">

### Author: ![aranjith0](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/aranjith0/32/13012_2.png) [@aranjith0](https://forums.percona.com/u/aranjith0)
#### Post date: [October 3, 2022, 9:30am UTC](https://forums.percona.com/t/unable-to-delete-backup/17701/3 "2022-10-03T09:30:57Z")

</div>

Yes, it works for me.

But when i run the full backup, it gave below warning :  
2022-10-03T09:27:58Z 0.00B [ERROR: get file 2022-10-03T09:27:58Z/configReplSet/local.oplog.rs.bson.s2: no such file] [2022-10-03T09:28:03Z]

But I verified that the backup is getting successful at the end.

```auto
[mongod@ip-10-80-10-113 ~]$ pbm status
Cluster:
========
configReplSet:
  - configReplSet/pmgo-pl204.int.compumark.com:27019: pbm-agent v2.0.0 OK
  - configReplSet/pmgo-pl202.int.compumark.com:27019: pbm-agent v2.0.0 OK
  - configReplSet/pmgo-pl206.int.compumark.com:27029: pbm-agent v2.0.0 OK
shard1ReplSet:
  - shard1ReplSet/pmgo-pl203.int.compumark.com:27018: pbm-agent v2.0.0 OK
  - shard1ReplSet/pmgo-pl201.int.compumark.com:27018: pbm-agent v2.0.0 OK
  - shard1ReplSet/pmgo-pl202.int.compumark.com:27028: pbm-agent v2.0.0 OK
shard2ReplSet:
  - shard2ReplSet/pmgo-pl204.int.compumark.com:27018: pbm-agent v2.0.0 OK
  - shard2ReplSet/pmgo-pl202.int.compumark.com:27018: pbm-agent v2.0.0 OK
  - shard2ReplSet/pmgo-pl205.int.compumark.com:27028: pbm-agent v2.0.0 OK
shard3ReplSet:
  - shard3ReplSet/pmgo-pl206.int.compumark.com:27018: pbm-agent v2.0.0 OK
  - shard3ReplSet/pmgo-pl205.int.compumark.com:27018: pbm-agent v2.0.0 OK
  - shard3ReplSet/pmgo-pl201.int.compumark.com:27028: pbm-agent v2.0.0 OK

PITR incremental backup:
========================
Status [OFF]

Currently running:
==================
Snapshot backup "2022-10-03T09:27:58Z", started at 2022-10-03T09:27:59Z. Status: snapshot backup. [op id: 633aab1e0ba693a0885ce775]

Backups:
========
S3 us-east-1 s3://cm-mongo-db-shared-prod-va/pbm/backup
  Snapshots:
    2022-10-03T09:27:58Z 0.00B <logical> [ERROR: get file 2022-10-03T09:27:58Z/configReplSet/local.oplog.rs.bson.s2: no such file] [2022-10-03T09:28:03Z]
    2022-09-28T09:20:02Z 1.86TB <logical> [restore_to_time: 2022-09-29T01:58:30Z]
    2022-09-28T07:57:20Z 14.85GB <logical, selective> [restore_to_time: 2022-09-28T08:16:32Z]
  PITR chunks [63.96GB]:
    2022-09-29T01:58:31Z - 2022-10-03T08:44:48Z

```
