Proxmox delete lvm snapshots on VM delete

EuroDomenii

Well-Known Member
Sep 30, 2016
139
25
48
Slatina
www.domenii.eu
Usually, all the lvm snapshots for a VM are removed on VM deletion. But, during some benchmarks, I needed to create more than 100 snapshots for a VM. This time, all the snapshots remained intact, despite deletion of the VM ( this is valid for several VMs).

Code:
root@melania:/etc/pve/qemu-server# lvdisplay | grep Path | grep snap | wc -l
175

Code:
lvmthin: local-lvm
        thinpool vmstore
        vgname vmdata
        content rootdir,images

Code:
root@melania:/etc/pve/qemu-server# pveversion
pve-manager/6.2-12/b287dd27 (running kernel: 5.4.65-1-pve)
root@melania:/etc/pve/qemu-server# dpkg -l | grep lvm
ii  libllvm7:amd64                       1:7.0.1-8+deb10u2                 amd64        Modular compiler and toolchain technologies, runtime library
ii  liblvm2cmd2.03:amd64                 2.03.02-pve4                      amd64        LVM2 command library
ii  lvm2                                 2.03.02-pve4                      amd64        Linux Logical Volume Manager

Thanks!
 
  • Like
Reactions: Dominic

Hannes Laimer

Proxmox Staff Member
Staff member
Jul 27, 2020
254
34
28
22
Algund
Hey,

do you get any warning/error messages from the destroy task?
 

EuroDomenii

Well-Known Member
Sep 30, 2016
139
25
48
Slatina
www.domenii.eu
This is how I've done the snapshots, during a https://www.phoronix-test-suite.com/

Code:
root@melania:/var/eurodomenii/scripts# cat snapshot_bench.sh
#https://superuser.com/questions/264528/problem-with-random-in-crontab
Number=$(bash -c 'echo $RANDOM')
qm snapshot $1 "snap-$Number" > /dev/null 2>&1

Code:
root@melania:/var/eurodomenii/scripts# cat /etc/crontab
*/15 * * * *      root    /var/eurodomenii/scripts/snapshot_bench.sh 404
 

Hannes Laimer

Proxmox Staff Member
Staff member
Jul 27, 2020
254
34
28
22
Algund
The problem is the - in the snapshot name, the GUI prevents the usage of - in the snapshot name, the CLI however doesn't (the CLI should also check that, and that will probably added). Removing the - from the snapshot name should resolve the problem, the snapshots already created have to be deleted manually.
You can use lvremove -S as described in https://man7.org/linux/man-pages/man8/lvremove.8.html.
 

Dominic

Proxmox Staff Member
Staff member
Mar 18, 2019
1,388
166
68
The patch is now applied in our git, so you should have the fix as soon as the package libpve-storage-perl 6.2-11 is out.
 

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!