We have a shared storage server using iSCSI with LVM on top shared between 8 hypervisors, whenever we remove a VM it's disks will be removed from the LVM but it's references in DM and the symlinks in /dev/mapper and /dev/volgroup/ will not be cleaned up.
When I try to clean up the unused dm nodes in /dev and remove the symlinks to them we can re-use the VMID again.
Deletion of the VM is done using the Proxmox Management web interface.
VM100, VM101 and VM102 are removed, this is the output from lvscan:
ACTIVE '/dev/vmstorage/vm-103-disk-2' [50,00 GiB] inherit
ACTIVE '/dev/vmstorage/vm-104-disk-1' [40,00 GiB] inherit
[...]
ACTIVE '/dev/pve/swap' [3,62 GiB] inherit
ACTIVE '/dev/pve/root' [25,94 GiB] inherit
The contents of /dev/mapper:
drwxr-xr-x 2 root root 520 okt 24 15:56 .
drwxr-xr-x 21 root root 4620 okt 24 15:56 ..
crw------- 1 root root 10, 236 okt 24 15:49 control
lrwxrwxrwx 1 root root 7 okt 24 15:49 pve-root -> ../dm-1
lrwxrwxrwx 1 root root 7 okt 24 15:49 pve-swap -> ../dm-0
lrwxrwxrwx 1 root root 7 okt 24 15:50 vmstorage-vm--100--disk--1 -> ../dm-2
lrwxrwxrwx 1 root root 7 okt 24 15:50 vmstorage-vm--101--disk--1 -> ../dm-3
lrwxrwxrwx 1 root root 8 okt 24 15:50 vmstorage-vm--101--disk--2 -> ../dm-12
lrwxrwxrwx 1 root root 7 okt 24 15:50 vmstorage-vm--102--disk--1 -> ../dm-4
lrwxrwxrwx 1 root root 7 okt 24 15:56 vmstorage-vm--103--disk--2 -> ../dm-5
lrwxrwxrwx 1 root root 7 okt 24 15:50 vmstorage-vm--104--disk--1 -> ../dm-6
lrwxrwxrwx 1 root root 8 okt 24 15:50 vmstorage-vm--104--disk--2 -> ../dm-13
The contents of /dev/vmstorage:
lrwxrwxrwx 1 root root 7 okt 24 15:50 vm-100-disk-1 -> ../dm-2
lrwxrwxrwx 1 root root 7 okt 24 15:50 vm-101-disk-1 -> ../dm-3
lrwxrwxrwx 1 root root 8 okt 24 15:50 vm-101-disk-2 -> ../dm-12
lrwxrwxrwx 1 root root 7 okt 24 15:50 vm-102-disk-1 -> ../dm-4
lrwxrwxrwx 1 root root 7 okt 24 15:56 vm-103-disk-2 -> ../dm-5
lrwxrwxrwx 1 root root 7 okt 24 15:50 vm-104-disk-1 -> ../dm-6
lrwxrwxrwx 1 root root 8 okt 24 15:50 vm-104-disk-2 -> ../dm-13
Sometimes when I remove the volume by hand (e.g. dmsetup remove vmstorage-vm--100--disk--1) even the symlinks still don't get removed, but in general that works fine. Whenever that happens I can clear them with a simple rm command.
I have to repeat this on all hypervisors by hand for all removed VMs which had storage in this iSCSI backed LVM storage. I did not try any other storage type yet, I am unable to switch over because some of the VMs are in production.
Does anyone have any clue to why Proxmox does not clean up all traces of the VM getting deleted? I can not find anything going 'wrong' in the logs, we only notice it happened again when we try to recycle a VM ID and it's creation is failing because of this error:
device-mapper: create ioctl on vmstorage-vm--100--disk--1LVM-7Nd10YZoG8pewnLgyFMc26XDHDCT2ADiOI6ug5mWqZqblX1ZBYeTT0gX030VsffK failed: Device or resource busy
TASK ERROR: create failed - lvcreate 'vmstorage/pve-vm-100' error: Failed to activate new LV.
Rebooting all the hypervisors also clears the issue, but only temporarily...
When I try to clean up the unused dm nodes in /dev and remove the symlinks to them we can re-use the VMID again.
Deletion of the VM is done using the Proxmox Management web interface.
VM100, VM101 and VM102 are removed, this is the output from lvscan:
ACTIVE '/dev/vmstorage/vm-103-disk-2' [50,00 GiB] inherit
ACTIVE '/dev/vmstorage/vm-104-disk-1' [40,00 GiB] inherit
[...]
ACTIVE '/dev/pve/swap' [3,62 GiB] inherit
ACTIVE '/dev/pve/root' [25,94 GiB] inherit
The contents of /dev/mapper:
drwxr-xr-x 2 root root 520 okt 24 15:56 .
drwxr-xr-x 21 root root 4620 okt 24 15:56 ..
crw------- 1 root root 10, 236 okt 24 15:49 control
lrwxrwxrwx 1 root root 7 okt 24 15:49 pve-root -> ../dm-1
lrwxrwxrwx 1 root root 7 okt 24 15:49 pve-swap -> ../dm-0
lrwxrwxrwx 1 root root 7 okt 24 15:50 vmstorage-vm--100--disk--1 -> ../dm-2
lrwxrwxrwx 1 root root 7 okt 24 15:50 vmstorage-vm--101--disk--1 -> ../dm-3
lrwxrwxrwx 1 root root 8 okt 24 15:50 vmstorage-vm--101--disk--2 -> ../dm-12
lrwxrwxrwx 1 root root 7 okt 24 15:50 vmstorage-vm--102--disk--1 -> ../dm-4
lrwxrwxrwx 1 root root 7 okt 24 15:56 vmstorage-vm--103--disk--2 -> ../dm-5
lrwxrwxrwx 1 root root 7 okt 24 15:50 vmstorage-vm--104--disk--1 -> ../dm-6
lrwxrwxrwx 1 root root 8 okt 24 15:50 vmstorage-vm--104--disk--2 -> ../dm-13
The contents of /dev/vmstorage:
lrwxrwxrwx 1 root root 7 okt 24 15:50 vm-100-disk-1 -> ../dm-2
lrwxrwxrwx 1 root root 7 okt 24 15:50 vm-101-disk-1 -> ../dm-3
lrwxrwxrwx 1 root root 8 okt 24 15:50 vm-101-disk-2 -> ../dm-12
lrwxrwxrwx 1 root root 7 okt 24 15:50 vm-102-disk-1 -> ../dm-4
lrwxrwxrwx 1 root root 7 okt 24 15:56 vm-103-disk-2 -> ../dm-5
lrwxrwxrwx 1 root root 7 okt 24 15:50 vm-104-disk-1 -> ../dm-6
lrwxrwxrwx 1 root root 8 okt 24 15:50 vm-104-disk-2 -> ../dm-13
Sometimes when I remove the volume by hand (e.g. dmsetup remove vmstorage-vm--100--disk--1) even the symlinks still don't get removed, but in general that works fine. Whenever that happens I can clear them with a simple rm command.
I have to repeat this on all hypervisors by hand for all removed VMs which had storage in this iSCSI backed LVM storage. I did not try any other storage type yet, I am unable to switch over because some of the VMs are in production.
Does anyone have any clue to why Proxmox does not clean up all traces of the VM getting deleted? I can not find anything going 'wrong' in the logs, we only notice it happened again when we try to recycle a VM ID and it's creation is failing because of this error:
device-mapper: create ioctl on vmstorage-vm--100--disk--1LVM-7Nd10YZoG8pewnLgyFMc26XDHDCT2ADiOI6ug5mWqZqblX1ZBYeTT0gX030VsffK failed: Device or resource busy
TASK ERROR: create failed - lvcreate 'vmstorage/pve-vm-100' error: Failed to activate new LV.
Rebooting all the hypervisors also clears the issue, but only temporarily...