2.14.2.1. Adding New Devices

This section provides information on adding new devices to your virtual machines. You can add new virtual devices to your virtual machine using the prlctl set command. The options responsible for adding particular devices are listed in the following table:

OptionDescription

hdd

Adds a new hard disk drive to the virtual machine. You can either connect an existing image to the virtual machine or create a new one.

Note

Note: SCSI and VirtIO hard disks can be added to both running and stopped VMs, IDE disks can only be added to stopped VMs.

cdrom

Adds a new CD/DVD-ROM drive to the virtual machine.

net

Adds a new network adapter to the virtual machine.

fdd

Adds a new floppy disk drive to the virtual machine.

serial

Adds a new serial port to the virtual machine.

usb

Adds a new USB controller to the virtual machine.

For example, you can execute the following command to add a new virtual disk to the virtual machine MyVM:

# prlctl set MyVM --device-add hdd
Creating hdd1 () scsi:1 image='/vz/vmprivate/d35d28e5-11f7-4b3f-9065-8fef6178bc5b/ \
harddisk1.hdd' type='expanded' 65536Mb subtype=virtio-scsi
Created hdd1 () scsi:1 image='/vz/vmprivate/d35d28e5-11f7-4b3f-9065-8fef6178bc5b/ \
harddisk1.hdd' type='expanded' subtype=virtio-scsi
The VM has been successfully configured.

This command creates a new virtual disk with the following default parameters:

  • name: hdd1
  • disk type: SCSI
  • disk subtype: VirtIO SCSI
  • image file name and location: /vz/vmprivate/d35d28e5-11f7-4b3f-9065-8fef6178bc5b/harddisk1.hdd
  • disk format: expanded
  • disk capacity: 65536 MB

You can redefine some of these parameters by specifying specific options during the command execution. For example, to create an IDE virtual disk that will have the capacity of 84 GB, you can run this command:

# prlctl set MyVM --device-add hdd --size 84000 --iface ide
Creating hdd2 () ide:0 image='/vz/vmprivate/d35d28e5-11f7-4b3f-9065-8fef6178bc5b/ \
harddisk2.hdd' type='expanded' 84000Mb
Created hdd2 () ide:0 image='/vz/vmprivate/d35d28e5-11f7-4b3f-9065-8fef6178bc5b/ \
harddisk2.hdd' type='expanded'
The VM has been successfully configured.

The virtual disk has been added to your virtual machine. However, before starting to use it, you must initialize the disk. Refer to the next subsection for information on how you can do it.

When managing devices, keep in mind the following:

  • You can connect up to 4 IDE devices, and 8 SCSI devices (virtual disks or CD/DVD-ROM drives) to a virtual machine.
  • A virtual machine can have up to 16 virtual network adapters.
  • A virtual machine can have up to 4 serial ports.
  • A virtual machine can have only 1 USB controller.
  • A virtual machine can have only 1 floppy disk drive.