What is the best way to delete all hard disks from a VM via command line?
So far the only option I've been able to come up with is manually parsing output from "qm config".
Once I have the storage name, in this case "scsi0", then I can use that to remove the storage
Then I need to remove the unused storage
Is there a better way to do this? Is there any use case where grepping for ".raw" won't return all of the hard disks?
So far the only option I've been able to come up with is manually parsing output from "qm config".
Code:
$ sudo qm config 148
boot:
meta: creation-qemu=7.2.0,ctime=1700604130
name: jenkins-pipeline-28
scsi0: local:148/vm-148-disk-0.raw,size=20980890K
smbios1: uuid=f2065a25-3992-48a6-bffd-5df4113690ad
vmgenid: a549306c-431d-4fb3-a1bd-fe63e347b2fb
$ sudo qm config 148 | grep ".raw"
scsi0: local:148/vm-148-disk-0.raw,size=20980890K
Once I have the storage name, in this case "scsi0", then I can use that to remove the storage
Code:
$ qm set 148 --delete scsi0
Then I need to remove the unused storage
Code:
$ qm set 148 --delete unused0
Is there a better way to do this? Is there any use case where grepping for ".raw" won't return all of the hard disks?