How do I recover disk space after moving a VM to another disk?

NickH

Active Member
Aug 13, 2020
33
1
28
65
In the past I had a VM, 108 on local-lvm which is a HDD. I moved it to an SSD by going to hardware, selecting the disk and move. That (apparently) worked fine and I've been using it for months. In reality I have made a mess of it as I didn't thin-provision the SSD, so I need to move it back for the moment to reformat the SSD.

Originally it was on the HDD as vm-108-disk-0 and on the SSD it was also vm-108-disk-0. Now I need to move it back, I see the original virtual disk, vm-108-disk-0 is still there, but moving it back then creates a vm-108-disk-1. How do I recover the space taken by the original vm-108-disk-0. If I select it in the `local-llvm (pve)` disk and try to delete it, it says:
Code:
Cannot remove image, a guest with VMID '108' exists!
You can delete the image from the guest's hardware pane
Sure the VM exists but not using that virtual disk and I don't want to delete it. How can I recover the disk space?
 
Last edited:
check the hardware pane of the guest, there should be 'unused' disks that you can remove
 
Thanks. That gets me a bit further. The disks now no longer show as "unused disks". I still, however, can't delete all of them. VM 108 worked OK. On VM 112 I have two virtual disks which were created during aborted VM moves. I've cleaned up the 'unused disks" section, but they still show in "lvs" and cannot be deleted from local-lvm. See screenshots:
1637141147190.png
1637141220225.png
1637141147190.png1637141220225.png
Code:
root@pve:~# lvs
  LV                                         VG        Attr       LSize    Pool Origin                            Data%  Meta%  Move Log Cpy%Sync Convert
  vm-111-disk-0                              nvme_2g_1 -wi-a-----    1.00t
  data                                       pve       twi-aotz-- <795.77g                                        38.98  2.28
  root                                       pve       -wi-ao----   96.00g
<snip>
  swap                                       pve       -wi-ao----    7.00g
  vm-110-disk-0                              pve       Vwi-a-tz--   96.00g data                                   8.81
  vm-112-disk-0                              pve       Vwi-a-tz--   32.00g data                                   30.59
  vm-112-disk-1                              pve       Vwi-a-tz--   32.00g data                                   0.00
  vm-112-disk-2                              pve       Vwi-a-tz--   32.00g data                                   10.14
<snip>
 
you can either remove them manually with 'pvesm free ..' if you are absolutely sure that they are not used anywhere anymore, or you can use 'qm rescan --vmid XXX' to add them back as unusedX entries to the VM config, and then remove them there.