$ virtctl addvolume <virtual-machine|virtual-machine-instance> \
--volume-name=<datavolume|PVC> \
[--bus <bus_type>] [--serial=<label_name>]
You can add or remove virtual disks without stopping your virtual machine (VM) or virtual machine instance (VMI).
Only data volumes and persistent volume claims (PVCs) can be hot plugged and hot-unplugged. You cannot hot plug or hot-unplug container disks.
A hot plugged disk remains attached to the VM even after reboot. You must unplug the disk to remove it from the VM.
|
Each VM has a When you hot plug disks to the VirtIO ( |
You can hot plug a disk by attaching it to a virtual machine (VM) while the VM is running by using the OKD web console.
The hot plugged disk remains attached to the VM until you unplug it.
You must have a data volume or persistent volume claim (PVC) available for hot plugging.
Navigate to Virtualization → VirtualMachines in the web console.
Select a running VM to view its details.
On the VirtualMachine details page, click Configuration → Storage.
Add a hot plugged disk:
click Add.
In the Add disk (hot plugged) window, select the disk from the Source list and click Save.
Optional: Select the type of the interface bus. The options are VirtIO and SCSI. The default bus type is VirtIO.
Optional: Change the type of the interface bus of an existing hot plugged disk:
click the Options menu beside the disk and select the Edit option.
In the Interface field, select the desired option.
Optional: Unplug a hot plugged disk:
click the Options menu beside the disk and select Detach.
click Detach.
You can hot plug and hot unplug a disk while a virtual machine (VM) is running by using the command line.
The hot plugged disk remains attached to the VM until you unplug it.
You must have at least one data volume or persistent volume claim (PVC) available for hot plugging.
Hot plug a disk by running the following command:
$ virtctl addvolume <virtual-machine|virtual-machine-instance> \
--volume-name=<datavolume|PVC> \
[--bus <bus_type>] [--serial=<label_name>]
The optional --bus flag allows you to specify the bus type of the added disk. The options are virtio and scsi. The default bus type is virtio.
The optional --serial flag allows you to add an alphanumeric string label of your choice. This helps you to identify the hot plugged disk in a guest virtual machine. If you do not specify this option, the label defaults to the name of the hot plugged data volume or PVC.
Hot unplug a disk by running the following command:
$ virtctl removevolume <virtual-machine|virtual-machine-instance> \
--volume-name=<datavolume|PVC>