auto remove tmp backup files post backing up

N0AGI

Member
Apr 6, 2021
18
1
8
54
hi,
I have a DC level backup schedule that takes and stores backup files on to a share on my n/w. I realize that vzdump uses a (local) temp folder to store temp backup files while its in progress of backing up. Is it possible to configure vzdump to clear those temp backup files after completion of the backup process ?

thanks
nagi
 
Hi,
vzdump allows to execute custom hook scripts at various points/states of the backup process [0], which you can configure in /etc/vzdump.conf. You might want to use that to perform the desired actions. An example hookscript can be found at cat /usr/share/doc/pve-manager/examples/vzdump-hook-script.pl.

[0] https://pve.proxmox.com/pve-docs/pve-admin-guide.html#_hook_scripts
 
  • Like
Reactions: N0AGI
Hi,
vzdump allows to execute custom hook scripts at various points/states of the backup process [0], which you can configure in /etc/vzdump.conf. You might want to use that to perform the desired actions. An example hookscript can be found at cat /usr/share/doc/pve-manager/examples/vzdump-hook-script.pl.

[0] https://pve.proxmox.com/pve-docs/pve-admin-guide.html#_hook_scripts
Actually, as @fiona pointed out to me correctly, the temp folder should get cleaned up automatically after a successful backup run. Are your files maybe some leftovers? Please double check if the backup job cleans up after itself.
 
in my vzdump.conf file, the override setting for tmp directory is not set. I therefore assume they're all going to a default temp folder. Do you know what the default temp folder is for vzdump files ?

As far as whether the temp files are being left over:
I notice the HDD usage space increase while the backups are running, However, have not seen the usage space go back down post the backup process completion. Consequently, I tend to believe that they are not getting cleared up post the backup process.

please correct me if I am wrong. Thanks
 
Hi,
in my vzdump.conf file, the override setting for tmp directory is not set. I therefore assume they're all going to a default temp folder. Do you know what the default temp folder is for vzdump files ?

As far as whether the temp files are being left over:
I notice the HDD usage space increase while the backups are running, However, have not seen the usage space go back down post the backup process completion. Consequently, I tend to believe that they are not getting cleared up post the backup process.

please correct me if I am wrong. Thanks
I assume the issue happens for container backups (VM backups only use the tmpdir for the configuration file)? Can you share the full backup log of a problematic backup? What kind of storage is the backup target? Is the HDD you mention, the disk with the root filesystem? The default tmpdir is either the backup target itself (if it is POSIX-compatible and if not using PBS) or /var/tmp/vzdumptmp<PID>_<VMID>.
 
Interesting, I don't see a /var/tmp/vzdumptmp<PID>_<VMID> format files at all in /var/tmp.

Attached is the backup log dump for the last backup job run.
FYI : My DC has one node and that node only hosts VMs currently. One of those VMs is a Portainer VM that hosts a few docker stacks/containers.
 

Attachments

  • task-pvep-vzdump-2023-09-08T02_00_08Z.log
    26.2 KB · Views: 1
I think I found the reason why I did not see HDD Usage size drop after the backup completion. The proxmox server's path to backups destination directory is a shared mapped to my nas storage location. This is done in the /etc/fstab and supposed to be set at boot time.

I just noticed that my server share mapping was not active and therefore, the backup path that was intended to be on my nas, was instead mapped to the local drive on the Proxmox server.

aarg... I think that might be the issue here.

I have remounted my nas shares and running the backup job again. let's see if that improves or changes the situation.

thanks everyone.
 
For that not happen in the future again run: pvesm set IdOfYourDirectoryStorage --is_mountpoint /path/to/your/smb/mountpoint

With that a failed mount would let the storage and backups fail without filling up your root fikesystem until the while server fails when completely full.
 
  • Like
Reactions: N0AGI
Hi,
vzdump allows to execute custom hook scripts at various points/states of the backup process [0], which you can configure in /etc/vzdump.conf. You might want to use that to perform the desired actions. An example hookscript can be found at cat /usr/share/doc/pve-manager/examples/vzdump-hook-script.pl.

[0] https://pve.proxmox.com/pve-docs/pve-admin-guide.html#_hook_scripts
I realize that this "hook" idea was originally suggested to clean up local hdd usage space. However, I have used this idea for additional "push notifications" before (phase=="backup-start"), and after backup ends (phase=="backup-end"). Works really well.

Thanks for the idea.
 
  • Like
Reactions: Chris

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!