[SOLVED] ceph : how to delete old snapshot rbd disk images, that have no corresponding snapshot in proxmox

Dec 6, 2022
42
13
8
we have a proxmox 8.0.3 running on ceph 17.2.6 . This clsuer is older and updated multiple times.
Today we run the command: rbd du --pool <poolname>

There we find out that in the past there must have been a problem with deleting TPM snapshot disks.
We have a lot of VMs that look slike this. In proxmox there are 10 snapshots in the UI.

Correct disk 0 :
Code:
vm-100-disk-0@autoweekly231001220413                        1 MiB     1 MiB
vm-100-disk-0@autoweekly231008220352                        1 MiB       0 B
vm-100-disk-0@autoweekly231015220350                        1 MiB       0 B
vm-100-disk-0@autodaily231020220806                         1 MiB     1 MiB
vm-100-disk-0@autodaily231021220640                         1 MiB       0 B
vm-100-disk-0@autodaily231022220508                         1 MiB       0 B
vm-100-disk-0@autoweekly231022220512                        1 MiB       0 B
vm-100-disk-0@autodaily231023220001                         1 MiB     1 MiB
vm-100-disk-0@autodaily231024220001                         1 MiB       0 B
vm-100-disk-0@autodaily231025221734                         1 MiB     1 MiB
vm-100-disk-0                                               1 MiB       0 B

Correct disk 1 :
Code:
vm-100-disk-1@autoweekly231001220413                      400 GiB    42 GiB
vm-100-disk-1@autoweekly231008220352                      400 GiB    26 GiB
vm-100-disk-1@autoweekly231015220350                      400 GiB    31 GiB
vm-100-disk-1@autodaily231020220806                       400 GiB    27 GiB
vm-100-disk-1@autodaily231021220640                       400 GiB    10 GiB
vm-100-disk-1@autodaily231022220508                       400 GiB   9.2 GiB
vm-100-disk-1@autoweekly231022220512                      400 GiB   204 MiB
vm-100-disk-1@autodaily231023220001                       400 GiB   7.8 GiB
vm-100-disk-1@autodaily231024220001                       400 GiB    19 GiB
vm-100-disk-1@autodaily231025221734                       400 GiB    21 GiB
vm-100-disk-1                                             400 GiB    14 GiB

Incorrcect TPM disk 2
Code:
vm-100-disk-2@autodaily220510010001                         4 MiB     4 MiB
vm-100-disk-2@autodaily220511010448                         4 MiB     4 MiB
vm-100-disk-2@autodaily220512010512                         4 MiB       0 B
vm-100-disk-2@autodaily220513010418                         4 MiB       0 B
vm-100-disk-2@autodaily220514010443                         4 MiB       0 B
vm-100-disk-2@autodaily220515010251                         4 MiB       0 B
vm-100-disk-2@autodaily220516010518                         4 MiB       0 B
vm-100-disk-2@autodaily220517010700                         4 MiB     4 MiB
vm-100-disk-2@autodaily220518010641                         4 MiB       0 B
vm-100-disk-2@autodaily220519010620                         4 MiB       0 B
vm-100-disk-2@autodaily220520010631                         4 MiB       0 B
vm-100-disk-2@autodaily220521010616                         4 MiB       0 B
vm-100-disk-2@autoweekly220522010350                        4 MiB       0 B
vm-100-disk-2@autodaily220522010529                         4 MiB       0 B
vm-100-disk-2@autodaily220523010632                         4 MiB       0 B
vm-100-disk-2@autodaily220524010622                         4 MiB       0 B
vm-100-disk-2@autodaily220525010524                         4 MiB     4 MiB
vm-100-disk-2@autodaily220526010217                         4 MiB     4 MiB
vm-100-disk-2@autodaily220527010206                         4 MiB       0 B
vm-100-disk-2@autodaily220528010207                         4 MiB       0 B
vm-100-disk-2@autoweekly220529010125                        4 MiB       0 B
vm-100-disk-2@autodaily220529010143                         4 MiB       0 B
vm-100-disk-2@autodaily220530010215                         4 MiB       0 B
[..manny more entries]


New snapshots are deleted correctly. So it must have been fixed.

Is there a way to delete all the old unused disk snapshots, where there is no corresponding proxmox snapshot anymore ?

My workaround would be, to delete all snapshots from 2022 and next year i could delete all left over disk snapshots from 2023
something ilke rbd snap rm {pool-name}/vm-*@autodaily22*

27.10.2023 : The rbd command does not allow wildcards in there snapshot remove command. So we ended up using this pipe
rbd du --pool <poolname> | grep ly22 | awk '{print "<poolname>/"$1}' | xargs -I {} rbd snap rm {}
Yes, this is very specific for our problem. But i thought i leave it here, in case someone needs it as inspiration.
 
Last edited:
  • Like
Reactions: mgabriel

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!