Purging a datastore

TwiX

Renowned Member
Feb 3, 2015
311
23
83
Hi,

My 2 synchronized PBS have a ZFS datastore which is 80% full disk space.

several hundreds of VMs and the issue is that when a VM is not backuped anymore, snapshots stay on the datastore forever. We have to manually delete groups one by one...
So I'm wondering if I could purge an entire datastore in one shot. The purpose is to restart with an empty datastore which should contains only prod/actual VMs and filled up progressively day after day.

Thanks!
Antoine
 
Hi,
you could either script the deletion of snapshots by using proxmox-backup-client snapshot forget <snapshot> or use a prune with a custom retention period e.g. proxmox-backup-client prune <group> --keep-last 1 to only keep the last snapshot for each group.
 
thanks, but it doesn't solve the issue relative to disk space (related to deduplication) and we have to adapt the script every time a VM is destroyed. could be complicated.

Ideally, a command or action that could delete everything before specified date
 
thanks, but it doesn't solve the issue relative to disk space (related to deduplication) and we have to adapt the script every time a VM is destroyed. could be complicated.
Well, you will of course have to run a garbage collection as well, to clean up unused chunks. Otherwise you will only remove the snapshot metadata, not the chunks themself.

Ideally, a command or action that could delete everything before specified date
keep-weekly/monthly/yearly should do the trick (although you will always have 1 remaining snapshot per group), alternatively you will have to wait for https://bugzilla.proxmox.com/show_bug.cgi?id=2863 being implemented.
 
If I want to restart with a clean datatsore, can I :

Code:
cd /zfs_datastore
rm -rf *

or should I destroy the datastore and recreate it ?
 
If I want to restart with a clean datatsore, can I :

Code:
cd /zfs_datastore
rm -rf *

or should I destroy the datastore and recreate it ?
If you don't care about the data, then you can destroy the datastore and recreate it (note that you will have to recreate it, as the directory structure is generated on creation, so only deleting everything leaves you with an unusable datastore).
 

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!