Unable to delete an unused VM disk and a non-existent VM disk

Globul

Member
Aug 6, 2020
38
0
11
48
Hi,

I have 2 disk that i can't delete.

The first one refers to an old VM that no longer exists and another disk is marked as unused in the VM. The VM is stopped but I can't delete it.
 
Hi,

what exactly is the issue that you're encountering? Are there any error messages you get? How did you try to delete the disk?
 
Hi,

what exactly is the issue that you're encountering? Are there any error messages you get? How did you try to delete the disk?
In both case, i have :
lvremove 'pve/vm-102-disk-0' error: Logical volume pve/vm-102-disk-0 in use.

The VM 102 don't exist.

In the other case, same message but the disk i want to delete is unused in the config.
 
Code:
root@pve:~# pvesm list local-lvm
Volid                   Format  Type              Size VMID
local-lvm:vm-100-disk-1 raw     images     16106127360 100
local-lvm:vm-101-disk-0 raw     images     34359738368 101
local-lvm:vm-101-disk-1 raw     images     34359738368 101
local-lvm:vm-102-disk-0 raw     images    107374182400 102
local-lvm:vm-103-disk-3 raw     images     34359738368 103
local-lvm:vm-104-disk-3 raw     images         4194304 104
local-lvm:vm-104-disk-4 raw     images     34359738368 104
local-lvm:vm-105-disk-1 raw     images     75161927680 105
local-lvm:vm-106-disk-0 raw     images     34359738368 106
local-lvm:vm-107-disk-0 raw     images     21474836480 107
local-lvm:vm-108-disk-0 raw     images     64424509440 108
local-lvm:vm-108-disk-1 raw     images     34359738368 108
local-lvm:vm-109-disk-0 raw     images     66571993088 109
local-lvm:vm-110-disk-0 raw     images     34359738368 110
local-lvm:vm-110-disk-1 raw     images     34359738368 110
local-lvm:vm-111-disk-0 raw     images     21474836480 111
local-lvm:vm-111-disk-1 raw     images     64424509440 111
local-lvm:vm-111-disk-2 raw     images     21474836480 111
local-lvm:vm-112-disk-0 raw     images     34359738368 112
local-lvm:vm-113-disk-1 raw     images     34359738368 113
local-lvm:vm-113-disk-2 raw     images     34359738368 113
local-lvm:vm-114-disk-0 raw     images     34359738368 114
local-lvm:vm-115-disk-2 raw     images     21474836480 115
local-lvm:vm-116-disk-0 raw     images     34359738368 116
local-lvm:vm-117-disk-0 raw     images     53687091200 117
local-lvm:vm-118-disk-0 raw     images     53687091200 118
local-lvm:vm-118-disk-1 raw     images    161061273600 118
local-lvm:vm-120-disk-0 raw     images     21474836480 120

Code:
root@pve:~# qm config 102
Configuration file 'nodes/pve/qemu-server/102.conf' does not exist

For the other one :

Code:
root@pve:~# qm config 108
agent: 1
boot: order=virtio0;ide2;net0
cores: 1
cpu: host
ide0: none,media=cdrom
ide2: none,media=cdrom
machine: pc-i440fx-5.2
memory: 4000
name: WINSERV22
net0: virtio=C6:89:90:9A:9A:7A,bridge=vmbr0,firewall=1
numa: 0
ostype: win10
scsihw: virtio-scsi-pci
smbios1: uuid=be43f242-0d6f-4f68-a536-364f2f586d1c
sockets: 2
tablet: 0
unused0: local-lvm:vm-108-disk-0
virtio0: local-lvm:vm-108-disk-1,cache=writeback,discard=on,size=32G
vmgenid: f22873ac-3715-44c0-8e62-d4aa2455db54
root@pve:~# lvremove 'pve/vm-108-disk-0'
  Logical volume pve/vm-108-disk-0 in use.
 
Last edited:
Hi,

what exactly is the issue that you're encountering? Are there any error messages you get? How did you try to delete the disk?
Hi, Can you help me ?

I've try several things i found in the forum with no success.
I try to delete the disks from the GUI and from the CLI, i always have the same result.
 
lvs |grep vm-102-disk-0

and then

lvremove /dev/local-lvm/vm-102-disk-0
 
lvs |grep vm-102-disk-0

and then

lvremove /dev/local-lvm/vm-102-disk-0
Didn't work

Code:
root@pve:~# lvs |grep vm-102-disk-0
  vm-102-disk-0 pve Vwi-aotz-- 100.00g data        99.41                                 
root@pve:~# lvremove /dev/local-lvm/vm-102-disk-0
  Volume group "local-lvm" not found
  Cannot process volume group local-lvm
 
Hi,
what does fuser -vau /dev/pve/vm-102-disk-0 show? If there's no result, you can try
Code:
root@pve701 ~ # ls -l /dev/pve/vm-102-disk-0
lrwxrwxrwx 1 root root 8 May 31 10:31 /dev/pve/vm-102-disk-0 -> ../dm-20
root@pve701 ~ # ls -l /sys/block/dm-20/holders
Note that the number for dm-20 will (most likely) be different for you.
 
Didn't work

Code:
root@pve:~# lvs |grep vm-102-disk-0
  vm-102-disk-0 pve Vwi-aotz-- 100.00g data        99.41                                
root@pve:~# lvremove /dev/local-lvm/vm-102-disk-0
  Volume group "local-lvm" not found
  Cannot process volume group local-lvm
Sorry it is lvremove /dev/pve/vm-102-disk-0, the name of your volumegroup
 
Sorry it is lvremove /dev/pve/vm-102-disk-0, the name of your volumegroup
Hi,
thanks for your reply...

Still doesn't work ... Disk in use and there is no VM 102

Code:
root@pve:~# fuser -vau /dev/pve/vm-102-disk-0
                     USER        PID ACCESS COMMAND
/dev/dm-7:
root@pve:~# ls -l /dev/pve/vm-102-disk-0
lrwxrwxrwx 1 root root 7 Apr 10 12:15 /dev/pve/vm-102-disk-0 -> ../dm-7
root@pve:~# ls -l /sys/block/dm-7/holders
total 0
root@pve:~# lvs |grep vm-102-disk-0
  vm-102-disk-0 pve Vwi-aotz-- 100.00g data        99.41                               
root@pve:~# lvremove /dev/pve/vm-102-disk-0
Logical volume pve/vm-102-disk-0 in use.

Same things for vm-108-disk-0 (unused disk of vm 108)
 
This is showing you that the logical volume in question is mapped (active.)

can you post the output of:
1. /etc/pve/qemu-server/102.conf
2. qm list
3. vgs

Here is ...

Code:
root@pve:~# cat /etc/pve/qemu-server/102.conf
cat: /etc/pve/qemu-server/102.conf: No such file or directory
root@pve:~# cat /etc/pve/qemu-server/108.conf
agent: 1
boot: order=virtio0;ide2;net0
cores: 1
cpu: host
ide0: none,media=cdrom
ide2: none,media=cdrom
machine: pc-i440fx-5.2
memory: 4000
name: WINSERV22
net0: virtio=C6:89:90:9A:9A:7A,bridge=vmbr0,firewall=1
numa: 0
ostype: win10
scsihw: virtio-scsi-pci
smbios1: uuid=be43f242-0d6f-4f68-a536-364f2f586d1c
sockets: 2
tablet: 0
unused0: local-lvm:vm-108-disk-0
virtio0: local-lvm:vm-108-disk-1,cache=writeback,discard=on,size=32G
vmgenid: f22873ac-3715-44c0-8e62-d4aa2455db54
root@pve:~# qm list
      VMID NAME                 STATUS     MEM(MB)    BOOTDISK(GB) PID       
       100 OMV                  running    2048              15.00 35782     
       101 PIHOLE               running    2048              32.00 36278     
       103 ONLYOFFICE           running    3072              32.00 36366     
       104 HOMEASSISTANT        running    2048              32.00 37310     
       105 NEXTCLOUD            running    6144              70.00 40635     
       106 JDOWNLOADER          running    2048              32.00 42504     
       107 NGINX                running    2048              20.00 39945     
       108 WINSERV22            stopped    4000              32.00 0         
       109 PLEX                 running    4096              62.00 52986     
       110 OPENVPN              running    1568              32.00 37671     
       111 GUACAMOLE            running    2048              20.00 43436     
       112 MAILGATEWAY          running    3072              32.00 43483     
       113 MINESERV             running    4016              32.00 29801     
       114 MINESERVDOR          stopped    4064              32.00 0         
       115 VAULTWARDEN          running    2048              20.00 39671     
       117 WINSERV19            running    5120              50.00 43622     
       118 VEEAMSERV            running    8000              50.00 43675     
       120 ZONEMINDER           running    8192              20.00 43739     
root@pve:~# vgs
  VG  #PV #LV #SN Attr   VSize  VFree 
  pve   1  31   0 wz--n- <1.82t <16.38g
root@pve:~#
 
107 NGINX running 2048 20.00 39945
I dont know how you have a vm running without a config, but it is running :)

you can stop it using qm stop 107

reading comprehension, yadda yadda ;)

lvchange -an pve/vm-102-disk-0
then run lvscan to verify that the lv is inactive
then lvremove pve/vm-102-disk-0
 
Last edited:
I dont know how you have a vm running without a config, but it is running :)

you can stop it using qm stop 107

reading comprehension, yadda yadda ;)

lvchange -an pve/vm-102-disk-0
then run lvscan to verify that the lv is inactive
then lvremove pve/vm-102-disk-0
Sorry still doesn't work

Code:
root@pve:~# lvchange -an pve/vm-102-disk-0
  Logical volume pve/vm-102-disk-0 in use.
root@pve:~# lvscan
  ACTIVE            '/dev/pve/swap' [8.00 GiB] inherit
  ACTIVE            '/dev/pve/root' [96.00 GiB] inherit
  ACTIVE            '/dev/pve/data' [1.67 TiB] inherit
  ACTIVE            '/dev/pve/vm-101-disk-0' [32.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-102-disk-0' [100.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-108-disk-0' [60.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-109-disk-0' [62.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-110-disk-0' [32.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-111-disk-1' [60.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-112-disk-0' [32.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-100-disk-1' [15.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-114-disk-0' [32.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-116-disk-0' [32.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-106-disk-0' [32.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-103-disk-3' [32.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-113-disk-1' [32.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-105-disk-1' [70.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-115-disk-2' [20.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-117-disk-0' [50.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-118-disk-0' [50.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-104-disk-3' [4.00 MiB] inherit
  ACTIVE            '/dev/pve/vm-104-disk-4' [32.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-108-disk-1' [32.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-111-disk-0' [20.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-120-disk-0' [20.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-107-disk-0' [20.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-118-disk-1' [150.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-101-disk-1' [32.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-110-disk-1' [32.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-111-disk-2' [20.00 GiB] inherit
  ACTIVE            '/dev/pve/vm-113-disk-2' [32.00 GiB] inherit
root@pve:~#

For all my unused disk, i have the same problem...
 

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!