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.
 

tom

Proxmox Staff Member
Staff member
Aug 29, 2006
15,659
973
173
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

m.ardito

Active Member
Feb 17, 2010
1,473
15
38
Torino, Italy
backup in pve is done by vzdump tool, via cron scripts. vzdump has a "hook script" option, see https://pve.proxmox.com/wiki/Vzdump_manual and /etc/cron.d/vzdump
I've never dealt with this kind of thing but default vzdump options should be here /etc/vzdump.conf
examples here /usr/share/doc/pve-manager/examples/vzdump-hook-script.pl

Marco
 

VecH

Active Member
Sep 12, 2015
43
0
26
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
 

wolfgang

Proxmox Retired Staff
Retired Staff
Oct 1, 2014
6,496
503
103
Hi,

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

now there are MAX Backup.
 

CarolBrown

New Member
Oct 25, 2017
15
2
3
31
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.
 

Marshalleq

Member
Oct 14, 2018
27
9
8
48
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.
 

alexskysilk

Renowned Member
Oct 16, 2015
892
123
68
Chatsworth, CA
www.skysilk.com
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.
 

killmasta93

Well-Known Member
Aug 13, 2017
918
54
53
29
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

Marshalleq

Member
Oct 14, 2018
27
9
8
48
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.
 

alexskysilk

Renowned Member
Oct 16, 2015
892
123
68
Chatsworth, CA
www.skysilk.com
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.
 

Marshalleq

Member
Oct 14, 2018
27
9
8
48
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.
 

CarolBrown

New Member
Oct 25, 2017
15
2
3
31
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.
 

CarolBrown

New Member
Oct 25, 2017
15
2
3
31
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

killmasta93

Well-Known Member
Aug 13, 2017
918
54
53
29
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
 

dcsapak

Proxmox Staff Member
Staff member
Feb 1, 2016
8,640
1,126
174
34
Vienna
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 your own in 60 seconds.

Buy now!