PBM backup deletion

Is there any command to delete the backups older than x days.

1 Like

Hello, yes there is. Take a look at Delete backups - Percona Backup for MongoDB

1 Like

@ Ivan_Groenewold,

If i want to delete the backups which is older than 5 days. Below command didn’t work. Please advise.

pbm delete-backup -f --older-than $(date -d ‘-5 days’ +%Y-%m-%d);

1 Like

The problem is likely in the output of the date expression. Try printing the date first, also what is the error?

1 Like

Hi Ivan_Groenewold,

It doesn’t throw any error. Its executing but not deleting anything.

[mongod@ip-xxxx pbm]$ pbm delete-backup -f --older-than $(date -d ‘-5 days’ +%Y-%m-%d);
Waiting for delete to be done …[done]
Backup snapshots:
2022-10-22T01:02:04Z [complete: 2022-10-22T23:00:52Z]
2022-11-05T01:02:04Z [complete: 2022-11-05T17:24:38Z]
2022-11-12T01:02:04Z [complete: 2022-11-12T23:25:56Z]

PITR :
2022-10-22T23:00:53Z - 2022-10-23T18:00:13Z
2022-11-05T17:24:39Z - 2022-11-06T18:00:11Z
2022-11-12T23:25:57Z - 2022-11-13T18:00:08Z

1 Like