Automatically delete old backups?

docmattman

New Member
Sep 14, 2012
29
0
1
I have a backup disk setup for my VMs. I have the number of backups set to 10 right now. However, I have a problem... The backup drive is full. There are many OLD backups on the drive and the new backups are failing. Does PVE automatically delete old backup dumps to make room for new ones? If so, can someone tell me how to set that up. Right now it's keeping the old backups and failing for new ones since there isn't enough space on the drive.
 
the number of backups to keep is a configuration setting on the storage definition. check "Datacenter/Storage/YOUR_BACKUP_STORAGE: max backups"
 
  • Like
Reactions: Hyacin
the number of backups to keep is a configuration setting on the storage definition. check "Datacenter/Storage/YOUR_BACKUP_STORAGE: max backups"
I use ProxMox 3.4 and ont find this options
Please describe in detail where this option
 
Hi,

on the GUI.
go to Datacenter -> Storage -> <Your backupstorage> "dopple click on it".

now there are MAX Backup.
 
Hi,

on the GUI.
go to Datacenter -> Storage -> <Your backupstorage> "dopple click on it".

now there are MAX Backup.
It doesn't work. Old backups are not being deleted. This feature just defines max amount of dump files. I went in file vzdump.conf and added in every string that corresponds to backup record key "--remove 1". That works.
 
Thanks - this seems to be a design flaw. Nobody in their right might would want backups to work like this. Perhaps everyone normally just sets max backups to 1000 and runs away? I don't know, but it makes no sense to have a setting that effectively just says, 'I'll run backups the amount of times you set here, then stop unless you delete them manually'. That's what it's doing. What am I missing? I did see someone complaining in a thread that the design had changed since earlier versions and people didn't like it - I guess we're still waiting for a fix for that. Doesn't give Proxmox much of a selling point to buy support when this kind of thing is hanging around.
 
Thanks - this seems to be a design flaw. Nobody in their right might would want backups to work like this. Perhaps everyone normally just sets max backups to 1000 and runs away? I don't know, but it makes no sense to have a setting that effectively just says, 'I'll run backups the amount of times you set here, then stop unless you delete them manually'. That's what it's doing. What am I missing? I did see someone complaining in a thread that the design had changed since earlier versions and people didn't like it - I guess we're still waiting for a fix for that. Doesn't give Proxmox much of a selling point to buy support when this kind of thing is hanging around.
It keeps the latest number of backups, and deletes the oldest when triggered.
 
heres a cron script it deletes automatic change the /media part to where it stores the dump
Code:
0 18 * * * find /media/external/proxmox -mindepth 1 -mtime +2 -name "*.vma.lzo" -delete
0 18 * * * find /media/external/proxmox -mindepth 1 -mtime +2 -name "*.log" -delete
 
  • Like
Reactions: slimmy
Hmmm, well mine I discovered wasn't deleting the old backups, after some months of running I, so effectively a feature that it meant to do backups had stopped because I'd reached the limit. I had to delete them manually to get it to work. I've just set the whole environment up again from scratch so I'll see what happens. I just mention this because @alexskysil seems to think it does this by default.
 
Hmmm, well mine I discovered wasn't deleting the old backups, after some months of running I, so effectively a feature that it meant to do backups had stopped because I'd reached the limit. I had to delete them manually to get it to work. I've just set the whole environment up again from scratch so I'll see what happens. I just mention this because @alexskysil seems to think it does this by default.

I hope it'll work for you as intended. Bear in mind that proxmox acts as a normal client to your storage device; if it doesn't have access or proper permissions it would not be able to perform the operations that require it.
 
I think it deletes it after it confirms the 4th backup is completed successfully from what I've read. I haven't gotten around to retesting this as I'm having so many performance issues with ZFS. Think I'll be going back to EXT4.
 
I have found a solution. It's so simply. Once you created a backup task you have to open file "/etc/pve/vzdump.cron" then find your task. It's looks like "1 2 3 * * --storage NFS --quiet 1 --notification" and etc. Just add "--remove 1" key in your task. By default it's defined as 0.This scheme works at more than 30 Proxmox servers for 1 year. Proxmox keeps amount of backups automatically by value ''Max Backups" in settings of storage. Also in this file you can manually add key "--maxfiles %number%" in each task.
 
heres a cron script it deletes automatic change the /media part to where it stores the dump
Code:
0 18 * * * find /media/external/proxmox -mindepth 1 -mtime +2 -name "*.vma.lzo" -delete
0 18 * * * find /media/external/proxmox -mindepth 1 -mtime +2 -name "*.log" -delete

It's very odd solution. We need to create the additional cron tasks. For what? But default vzdump.cron has similar feature that works. Just read my post above. As a proof I attach the content of my vzdump.cron file:

Code:
0 21 * * *           root vzdump 103 102 --node YMTAQ-SV-HV04 --quiet 1 --mailnotification always --mailto penguin@polar.aq --remove 1 --compress lzo --mode snapshot --storage NFS --maxfiles 1
0 21 * * *           root vzdump 102 --node YMTAQ-SV-HV04 --quiet 1 --remove 1 --mailnotification always --mailto penguin@polar.aq --compress lzo --storage SOFTRAID --mode snapshot
0 18 * * 6           root vzdump 101 --quiet 1 --node YMTAQ-SV-HV04 --compress lzo --mode suspend --storage NFS --mailnotification always --mailto penguin@polar.aq --remove 1
0 20 * * 3           root vzdump 101 --storage SOFTRAID --mode suspend --compress lzo --mailto penguin@polar.aq --mailnotification always --remove 1 --quiet 1 --node YMTAQ-SV-HV04
0 18 * * 3           root vzdump 104 --storage SOFTRAID --mode suspend --compress lzo --remove 1 --mailto penguin@polar.aq --mailnotification always --quiet 1 --node YMTAQ-SV-HV04
0 18 * * 7           root vzdump 105 --quiet 1 --node YMTAQ-SV-HV04 --compress lzo --mode snapshot --storage NFS --mailnotification always --mailto penguin@polar.aq --remove 1
0 20 * * 4           root vzdump 100 --compress lzo --storage NFS --mode snapshot --remove 1 --mailnotification always --mailto penguin@polar.aq --quiet 1 --node YMTAQ-SV-HV04
0 3 * * 2           root vzdump 105 --quiet 1 --node YMTAQ-SV-HV04 --compress lzo --mode snapshot --storage NFS --mailnotification always --mailto penguin@polar.aq --remove 1
0 18 * * 6           root vzdump 104 --storage NFS --mode suspend --compress lzo --mailto penguin@polar.aq --mailnotification always --remove 1 --quiet 1 --node YMTAQ-SV-HV04
0 20 * * 4           root vzdump 105 --mailnotification always --mailto penguin@polar.aq --remove 1 --compress lzo --mode snapshot --storage SOFTRAID --node YMTAQ-SV-HV04 --quiet 1
 
  • Like
Reactions: killmasta93
It's very odd solution. We need to create the additional cron tasks. For what? But default vzdump.cron has similar feature that works. Just read my post above. As a proof I attach the content of my vzdump.cron file:

Code:
0 21 * * *           root vzdump 103 102 --node YMTAQ-SV-HV04 --quiet 1 --mailnotification always --mailto penguin@polar.aq --remove 1 --compress lzo --mode snapshot --storage NFS --maxfiles 1
0 21 * * *           root vzdump 102 --node YMTAQ-SV-HV04 --quiet 1 --remove 1 --mailnotification always --mailto penguin@polar.aq --compress lzo --storage SOFTRAID --mode snapshot
0 18 * * 6           root vzdump 101 --quiet 1 --node YMTAQ-SV-HV04 --compress lzo --mode suspend --storage NFS --mailnotification always --mailto penguin@polar.aq --remove 1
0 20 * * 3           root vzdump 101 --storage SOFTRAID --mode suspend --compress lzo --mailto penguin@polar.aq --mailnotification always --remove 1 --quiet 1 --node YMTAQ-SV-HV04
0 18 * * 3           root vzdump 104 --storage SOFTRAID --mode suspend --compress lzo --remove 1 --mailto penguin@polar.aq --mailnotification always --quiet 1 --node YMTAQ-SV-HV04
0 18 * * 7           root vzdump 105 --quiet 1 --node YMTAQ-SV-HV04 --compress lzo --mode snapshot --storage NFS --mailnotification always --mailto penguin@polar.aq --remove 1
0 20 * * 4           root vzdump 100 --compress lzo --storage NFS --mode snapshot --remove 1 --mailnotification always --mailto penguin@polar.aq --quiet 1 --node YMTAQ-SV-HV04
0 3 * * 2           root vzdump 105 --quiet 1 --node YMTAQ-SV-HV04 --compress lzo --mode snapshot --storage NFS --mailnotification always --mailto penguin@polar.aq --remove 1
0 18 * * 6           root vzdump 104 --storage NFS --mode suspend --compress lzo --mailto penguin@polar.aq --mailnotification always --remove 1 --quiet 1 --node YMTAQ-SV-HV04
0 20 * * 4           root vzdump 105 --mailnotification always --mailto penguin@polar.aq --remove 1 --compress lzo --mode snapshot --storage SOFTRAID --node YMTAQ-SV-HV04 --quiet 1
yeah your right i just realized that i guess no need for that cron job anymore
 
I wonder why developers didn't add this checkbox to the WEB-interface. Maybe enterprise version has it?
it is default since a very long time

also there is no feature difference between versions all features are always available
 
  • Like
Reactions: DerDanilo

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!