Feature Request: Button to delete all snapshots at once

zikkz

Member
Dec 19, 2021
3
4
8
34
Hello. In ESX/vCenter it is possible to delete all snapshots at once under Snapshots with the button “Delete all”. With Proxmox VE you have to select each individual snapshot once, click Remove and then the next, and the next, and the next...
It would simplify this somewhat if you also had a “Delete all snapshots” button here.
 
  • Like
Reactions: IsThisThingOn
/ I love getting ideas from these forums ;-)
Might as well make it node-independent :)
Code:
#!/bin/bash

if [[ $# -lt 1 ]];then
  echo "USAGE: $0 [VMID]"
  exit 1
fi

VMID=$1
NODE=$(pvesh get /cluster/resources --type vm --output-format json|jq --argjson myvmid $VMID -r '.[]|select( .vmid == $myvmid )|.node')
echo "removing all snapshots from VM $VMID located on node $NODE"

for snap in $(pvesh get /nodes/$NODE/qemu/$VMID/snapshot --output-format json|jq -r 'sort_by(.snaptime)|.[]|select(.snaptime != null)|.name');do
  pvesh delete /nodes/$NODE/qemu/$VMID/snapshot/$snap
done


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 

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!