2.14.2.4. Deleting Devices

You can delete a virtual device that you do not need any more in your virtual machine using the --device-del option of the prlctl set command. The options responsible for removing particular devices are listed in the following table:

OptionDescription

hdd

Deletes the specified hard disk drive from the virtual machine.

Note

Note: IDE and SCSI disks can be removed from stopped virtual machines only.

cdrom

Deletes the specified CD/DVD-ROM drive from the virtual machine.

net

Deletes the specified network adapter from the virtual machine.

fdd

Deletes the floppy disk drive from the virtual machine.

serial

Deletes the specified serial port from the virtual machine.

usb

Deletes the USB controller from the virtual machine.

As a rule deleting a virtual device involves performing two operations:

  1. Finding out the name of the device to be deleted.
  2. Deleting the device from the virtual machine.

Finding Out the Device Name

To remove a virtual device, you need to specify its name when running the prlctl set command. If you do not know the device name, you can use the prlctl list command to learn it. For example, to obtain the list of virtual devices in the MyVM virtual machine, run this command:

# prlctl list --info MyVM
...
Hardware:
  cpu cpus=2 VT-x accl=high mode=32 ioprio=4 iolimit='0'
  memory 1024Mb
  video 32Mb 3d acceleration=off vertical sync=yes
  fdd0 () real='/dev/fd0' state=disconnected
  hdd0 () scsi:0 image='/vz/vmprivate/d35d28e5-11f7-4b3f-9065-8fef6178bc5b/ \
harddisk.hdd' type='expanded' subtype=virtio-scsi
  hdd1 () ide:0 image='/vz/vmprivate/d35d28e5-11f7-4b3f-9065-8fef6178bc5b/ \
harddisk1.hdd' type='expanded'
  cdrom0 () ide:1 real='Default CD/DVD-ROM'
  usb ()
  net0 () dev='vme426f6594' network='Bridged' mac=001C426F6594 card=virtio
...

All virtual devices currently available to the virtual machine are listed under Hardware. In our case the virtual machine MyVM has the following devices: 2 CPUs, main memory, video memory, a floppy disk drive, 2 hard disk drives, a CD/DVD-ROM drive, a USB controller, and a network card.

Deleting a Virtual Device

Once you know the virtual device name, you can remove it from your virtual machine. For example, you can execute the following command to remove the virtual disk hdd1 from the virtual machine MyVM:

# prlctl set MyVM --device-del hdd1
Remove the hdd1 device.
The VM has been successfully configured.

If you do not want to permanently delete a virtual device, you can temporarily disconnect if from the virtual machine using the --disable option.