How to delete/detach a disk from online VM ?

Hello. Is it possible to remove a (unmounted, unused) disk from a VM when online? I tried via the UI and I get 'Error while executing action: Cannot remove Virtual Disk. At least one of the VMs is not down.' I know you can with standard KVM/Libvirt/virt-manager - is there any way I can remove a disk from a VM whilst it is online in Ovirt ? Thanks

On Wed, Mar 22, 2023 at 12:00 PM morgan cox <morgancoxuk@gmail.com> wrote:
Hello.
Is it possible to remove a (unmounted, unused) disk from a VM when online?
I tried via the UI and I get 'Error while executing action: Cannot remove Virtual Disk. At least one of the VMs is not down.'
I know you can with standard KVM/Libvirt/virt-manager - is there any way I can remove a disk from a VM whilst it is online in Ovirt ?
Thanks
Preliminary task is to remove the device from VM OS point of view. This way you don't get error messages when you unplug it from oVirt UI If not used, not mounted, you can simply run echo 1 > /sys/block/device-name/device/delete Pay attention to device-name, that should match your intended one! Then I think you should go under the disks subtab of the running vm, select the disk and deactivate it. Then you can remove it. In case you already went through this, what is your oVirt version and which type of virtual disk (virtio/virtio-scsi, ecc..)? See also here the documentation for other details: https://www.ovirt.org/documentation/virtual_machine_management_guide/index.h... HIH, Gianluca

Hi,
On 22 Mar 2023, at 18:00, morgan cox <morgancoxuk@gmail.com> wrote:
I tried via the UI and I get 'Error while executing action: Cannot remove Virtual Disk. At least one of the VMs is not down.'
I know you can with standard KVM/Libvirt/virt-manager - is there any way I can remove a disk from a VM whilst it is online in Ovirt ?
Disk should be deactivated (unplugged from VM), then detached (unplugged from object VM), then can be removed Impossible to remove disk from computer without cable unplug k

Thank you both of you, especially for the quick responses... The solution I used was as Konstantin said deactivate the disk first .... Disks can now be removed. Cheers !
participants (3)
-
Gianluca Cecchi
-
Konstantin Shalygin
-
morgan cox