[SOLVED] Remove VM disk from CLI?

Dec 13, 2021
24
6
8
Hi I run proxmox 7.2-7, I'm trying to remove a VM disk from the CLI.
I have tried the following:
Code:
qm set $VMID --delete scsi0
zfs destroy -f $STORAGE/vm-$VMID-disk-0

The first command seems to mark the disk as unused, and the second removes the zfs volume, but the UI still believes the disk is there?
What is the correct way to delete a disk from a VM using cli?
 
I think I managed to find the correct way qm set $VMID --delete unused0 would have been nice if
qm set $VMID --delete scsi0 had printed out unused0 so that I had a hint. (This also seems to delete the zfs volume so I don't have to delete it any more)
 
  • Like
Reactions: leesteken
qm destroy $VMID --destroy-unreferenced-disks
I know this is an OLD thread/post - but readers should note that the above command will delete the whole VM & also all disks not referenced in the config but with a matching VMID from all enabled storages. (Source from qm manpage).
 
  • Like
Reactions: UdoB