]> git.proxmox.com Git - pve-docs.git/blobdiff - qm.adoc
update generated docs
[pve-docs.git] / qm.adoc
diff --git a/qm.adoc b/qm.adoc
index 8eab627e8423554947f8c56fb0ec8e1dbe29c8a4..02a4555d1a2a7292acef4d8332ec52e350230869 100644 (file)
--- a/qm.adoc
+++ b/qm.adoc
@@ -40,7 +40,7 @@ devices, and runs as it were running on real hardware. For instance you can pass
 an iso image as a parameter to Qemu, and the OS running in the emulated computer
 will see a real CDROM inserted in a CD drive.
 
-Qemu can emulates a great variety of hardware from ARM to Sparc, but {pve} is
+Qemu can emulate a great variety of hardware from ARM to Sparc, but {pve} is
 only concerned with 32 and 64 bits PC clone emulation, since it represents the
 overwhelming majority of server hardware. The emulation of PC clones is also one
 of the fastest due to the availability of processor extensions which greatly
@@ -50,7 +50,7 @@ architecture.
 NOTE: You may sometimes encounter the term _KVM_ (Kernel-based Virtual Machine).
 It means that Qemu is running with the support of the virtualization processor
 extensions, via the Linux kvm module. In the context of {pve} _Qemu_ and
-_KVM_ can be use interchangeably as Qemu in {pve} will always try to load the kvm
+_KVM_ can be used interchangeably as Qemu in {pve} will always try to load the kvm
 module.
 
 Qemu inside {pve} runs as a root process, since this is required to access block
@@ -101,7 +101,7 @@ could incur a performance slowdown, or putting your data at risk.
 General Settings
 ~~~~~~~~~~~~~~~~
 
-[thumbnail="qm-general-settings.png"]
+[thumbnail="gui-create-vm-general.png"]
 
 General settings of a VM include
 
@@ -115,7 +115,7 @@ General settings of a VM include
 OS Settings
 ~~~~~~~~~~~
 
-[thumbnail="qm-os-settings.png"]
+[thumbnail="gui-create-vm-os.png"]
 
 When creating a VM, setting the proper Operating System(OS) allows {pve} to
 optimize some low level parameters. For instance Windows OS expect the BIOS
@@ -131,7 +131,7 @@ Qemu can emulate a number of storage controllers:
 
 * the *IDE* controller, has a design which goes back to the 1984 PC/AT disk
 controller. Even if this controller has been superseded by more more designs,
-each and every OS you can think has support for it, making it a great choice
+each and every OS you can think of has support for it, making it a great choice
 if you want to run an OS released before 2003. You can connect up to 4 devices
 on this controller.
 
@@ -143,18 +143,22 @@ connected. You can connect up to 6 devices on this controller.
 hardware, and can connect up to 14 storage devices. {pve} emulates by default a
 LSI 53C895A controller.
 +
-A SCSI controller of type _Virtio_ is the recommended setting if you aim for
+A SCSI controller of type _VirtIO SCSI_ is the recommended setting if you aim for
 performance and is automatically selected for newly created Linux VMs since
 {pve} 4.3. Linux distributions have support for this controller since 2012, and
 FreeBSD since 2014. For Windows OSes, you need to provide an extra iso
 containing the drivers during the installation.
 // https://pve.proxmox.com/wiki/Paravirtualized_Block_Drivers_for_Windows#During_windows_installation.
+If you aim at maximum performance, you can select a SCSI controller of type
+_VirtIO SCSI single_ which will allow you to select the *IO Thread* option.
+When selecting _VirtIO SCSI single_ Qemu will create a new controller for
+each disk, instead of adding all disks to the same controller.
 
 * The *Virtio* controller, also called virtio-blk to distinguish from
-the Virtio SCSI controller, is an older type of paravirtualized controller
+the VirtIO SCSI controller, is an older type of paravirtualized controller
 which has been superseded in features by the Virtio SCSI Controller.
 
-[thumbnail="qm-hard-disk.png"]
+[thumbnail="gui-create-vm-hard-disk.png"]
 On each controller you attach a number of emulated hard disks, which are backed
 by a file or a block device residing in the configured storage. The choice of
 a storage type will determine the format of the hard disk image. Storages which
@@ -182,6 +186,12 @@ This provides a good balance between safety and speed.
 If you want the {pve} backup manager to skip a disk when doing a backup of a VM,
 you can set the *No backup* option on that disk.
 
+If you want the {pve} storage replication mechanism to skip a disk when starting
+ a replication job, you can set the *Skip replication* option on that disk.
+As of {pve} 5.0, replication requires the disk images to be on a storage of type
+`zfspool`, so adding a disk image to other storages when the VM has replication
+configured requires to skip replication for this disk image.
+
 If your storage supports _thin provisioning_ (see the storage chapter in the
 {pve} guide), and your VM has a *SCSI* controller you can activate the *Discard*
 option on the hard disks connected to that controller. With *Discard* enabled,
@@ -190,10 +200,12 @@ emulated SCSI controller will relay this information to the storage, which will
 then shrink the disk image accordingly.
 
 .IO Thread
-The option *IO Thread* can only be enabled when using a disk with the *VirtIO* controller,
-or with the *SCSI* controller, when the emulated controller type is  *VirtIO SCSI*.
-With this enabled, Qemu uses one thread per disk, instead of one thread for all,
-so it should increase performance when using multiple disks.
+The option *IO Thread* can only be used when using a disk with the
+*VirtIO* controller, or with the *SCSI* controller, when the emulated controller
+ type is  *VirtIO SCSI single*.
+With this enabled, Qemu creates one I/O thread per storage controller,
+instead of a single thread for all I/O, so it increases performance when
+multiple disks are used and each disk has its own storage controller.
 Note that backups do not currently work with *IO Thread* enabled.
 
 
@@ -201,7 +213,7 @@ Note that backups do not currently work with *IO Thread* enabled.
 CPU
 ~~~
 
-[thumbnail="qm-cpu-settings.png"]
+[thumbnail="gui-create-vm-cpu.png"]
 
 A *CPU socket* is a physical slot on a PC motherboard where you can plug a CPU.
 This CPU can then contain one or many *cores*, which are independent
@@ -267,16 +279,27 @@ Memory
 
 For each VM you have the option to set a fixed size memory or asking
 {pve} to dynamically allocate memory based on the current RAM usage of the
-host. 
+host.
 
 .Fixed Memory Allocation
-[thumbnail="qm-memory-fixed.png"]
+[thumbnail="gui-create-vm-memory-fixed.png"]
 
 When choosing a *fixed size memory* {pve} will simply allocate what you
 specify to your VM.
 
+Even when using a fixed memory size, the ballooning device gets added to the
+VM, because it delivers useful information such as how much memory the guest
+really uses.
+In general, you should leave *ballooning* enabled, but if you want to disable
+it (e.g. for debugging purposes), simply uncheck
+*Ballooning* or set
+
+ balloon: 0
+
+in the configuration.
+
 .Automatic Memory Allocation
-[thumbnail="qm-memory-auto.png", float="left"]
+[thumbnail="gui-create-vm-memory-dynamic.png", float="left"]
 
 // see autoballoon() in pvestatd.pm
 When choosing to *automatically allocate memory*, {pve} will make sure that the
@@ -306,7 +329,7 @@ get 1/5 GB.
 All Linux distributions released after 2010 have the balloon kernel driver
 included. For Windows OSes, the balloon driver needs to be added manually and can
 incur a slowdown of the guest, so we don't recommend using it on critical
-systems. 
+systems.
 // see https://forum.proxmox.com/threads/solved-hyper-threading-vs-no-hyper-threading-fixed-vs-variable-memory.20265/
 
 When allocating RAMs to your VMs, a good rule of thumb is always to leave 1GB
@@ -317,7 +340,7 @@ of RAM available to the host.
 Network Device
 ~~~~~~~~~~~~~~
 
-[thumbnail="qm-network.png"]
+[thumbnail="gui-create-vm-network.png"]
 
 Each VM can have many _Network interface controllers_ (NIC), of four different
 types:
@@ -327,7 +350,7 @@ types:
 performance. Like all VirtIO devices, the guest OS should have the proper driver
 installed.
  * the *Realtek 8139* emulates an older 100 MB/s network card, and should
-only be used when emulating older operating systems ( released before 2002 ) 
+only be used when emulating older operating systems ( released before 2002 )
  * the *vmxnet3* is another paravirtualized device, which should only be used
 when importing a VM from another hypervisor.
 
@@ -365,7 +388,7 @@ network queues to the host kernel for each NIC.
 When using Multiqueue, it is recommended to set it to a value equal
 to the number of Total Cores of your guest. You also need to set in
 the VM the number of multi-purpose channels on each VirtIO NIC with the ethtool
-command: 
+command:
 
 `ethtool -L eth0 combined X`
 
@@ -378,6 +401,7 @@ process a great number of incoming connections, such as when the VM is running
 as a router, reverse proxy or a busy HTTP server doing long polling.
 
 
+[[qm_usb_passthrough]]
 USB Passthrough
 ~~~~~~~~~~~~~~~
 
@@ -404,7 +428,7 @@ If a device is present in a VM configuration when the VM starts up,
 but the device is not present in the host, the VM can boot without problems.
 As soon as the device/port ist available in the host, it gets passed through.
 
-WARNING: Using this kind of USB passthrough, means that you cannot move
+WARNING: Using this kind of USB passthrough means that you cannot move
 a VM online to another host, since the hardware is only available
 on the host the VM is currently residing.
 
@@ -457,10 +481,14 @@ the following command:
 
  qm set <vmid> -onboot 1
 
-In some case you want to be able to fine tune the boot order of your VMs, for
-instance if one of your VM is providing firewalling or DHCP to other guest
-systems.
-For this you can use the following parameters:
+.Start and Shutdown Order
+
+[thumbnail="gui-qemu-edit-start-order.png"]
+
+In some case you want to be able to fine tune the boot order of your
+VMs, for instance if one of your VM is providing firewalling or DHCP
+to other guest systems.  For this you can use the following
+parameters:
 
 * *Start/Shutdown order*: Defines the start order priority. E.g. set it to 1 if
 you want the VM to be the first to be started. (We use the reverse startup
@@ -475,11 +503,223 @@ By default this value is set to 60, which means that {pve} will issue a
 shutdown request, wait 60s for the machine to be offline, and if after 60s
 the machine is still online will notify that the shutdown action failed.
 
+NOTE: VMs managed by the HA stack do not follow the 'start on boot' and
+'boot order' options currently. Those VMs will be skipped by the startup and
+shutdown algorithm as the HA manager itself ensures that VMs get started and
+stopped.
+
 Please note that machines without a Start/Shutdown order parameter will always
 start after those where the parameter is set, and this parameter only
 makes sense between the machines running locally on a host, and not
 cluster-wide.
 
+
+[[qm_migration]]
+Migration
+---------
+
+[thumbnail="gui-qemu-migrate.png"]
+
+If you have a cluster, you can migrate your VM to another host with
+
+ qm migrate <vmid> <target>
+
+There are generally two mechanisms for this
+
+* Online Migration (aka Live Migration)
+* Offline Migration
+
+Online Migration
+~~~~~~~~~~~~~~~~
+
+When your VM is running and it has no local resources defined (such as disks
+on local storage, passed through devices, etc.) you can initiate a live
+migration with the -online flag.
+
+How it works
+^^^^^^^^^^^^
+
+This starts a Qemu Process on the target host with the 'incoming' flag, which
+means that the process starts and waits for the memory data and device states
+from the source Virtual Machine (since all other resources, e.g. disks,
+are shared, the memory content and device state are the only things left
+to transmit).
+
+Once this connection is established, the source begins to send the memory
+content asynchronously to the target. If the memory on the source changes,
+those sections are marked dirty and there will be another pass of sending data.
+This happens until the amount of data to send is so small that it can
+pause the VM on the source, send the remaining data to the target and start
+the VM on the target in under a second.
+
+Requirements
+^^^^^^^^^^^^
+
+For Live Migration to work, there are some things required:
+
+* The VM has no local resources (e.g. passed through devices, local disks, etc.)
+* The hosts are in the same {pve} cluster.
+* The hosts have a working (and reliable) network connection.
+* The target host must have the same or higher versions of the
+  {pve} packages. (It *might* work the other way, but this is never guaranteed)
+
+Offline Migration
+~~~~~~~~~~~~~~~~~
+
+If you have local resources, you can still offline migrate your VMs,
+as long as all disk are on storages, which are defined on both hosts.
+Then the migration will copy the disk over the network to the target host.
+
+[[qm_copy_and_clone]]
+Copies and Clones
+-----------------
+
+[thumbnail="gui-qemu-full-clone.png"]
+
+VM installation is usually done using an installation media (CD-ROM)
+from the operation system vendor. Depending on the OS, this can be a
+time consuming task one might want to avoid.
+
+An easy way to deploy many VMs of the same type is to copy an existing
+VM. We use the term 'clone' for such copies, and distinguish between
+'linked' and 'full' clones.
+
+Full Clone::
+
+The result of such copy is an independent VM. The
+new VM does not share any storage resources with the original.
++
+
+It is possible to select a *Target Storage*, so one can use this to
+migrate a VM to a totally different storage. You can also change the
+disk image *Format* if the storage driver supports several formats.
++
+
+NOTE: A full clone need to read and copy all VM image data. This is
+usually much slower than creating a linked clone.
++
+
+Some storage types allows to copy a specific *Snapshot*, which
+defaults to the 'current' VM data. This also means that the final copy
+never includes any additional snapshots from the original VM.
+
+
+Linked Clone::
+
+Modern storage drivers supports a way to generate fast linked
+clones. Such a clone is a writable copy whose initial contents are the
+same as the original data. Creating a linked clone is nearly
+instantaneous, and initially consumes no additional space.
++
+
+They are called 'linked' because the new image still refers to the
+original. Unmodified data blocks are read from the original image, but
+modification are written (and afterwards read) from a new
+location. This technique is called 'Copy-on-write'.
++
+
+This requires that the original volume is read-only. With {pve} one
+can convert any VM into a read-only <<qm_templates, Template>>). Such
+templates can later be used to create linked clones efficiently.
++
+
+NOTE: You cannot delete the original template while linked clones
+exists.
++
+
+It is not possible to change the *Target storage* for linked clones,
+because this is a storage internal feature.
+
+
+The *Target node* option allows you to create the new VM on a
+different node. The only restriction is that the VM is on shared
+storage, and that storage is also available on the target node.
+
+To avoid resource conflicts, all network interface MAC addresses gets
+randomized, and we generate a new 'UUID' for the VM BIOS (smbios1)
+setting.
+
+
+[[qm_templates]]
+Virtual Machine Templates
+-------------------------
+
+One can convert a VM into a Template. Such templates are read-only,
+and you can use them to create linked clones.
+
+NOTE: It is not possible to start templates, because this would modify
+the disk images. If you want to change the template, create a linked
+clone and modify that.
+
+Importing Virtual Machines from foreign hypervisors
+---------------------------------------------------
+
+A VM export from a foreign hypervisor takes usually the form of one or more disk
+ images, with a configuration file describing the settings of the VM (RAM,
+ number of cores). +
+The disk images can be in the vmdk format, if the disks come from
+VMware or VirtualBox, or qcow2 if the disks come from a KVM hypervisor.
+The most popular configuration format for VM exports is the OVF standard, but in
+practice interoperation is limited because many settings are not implemented in
+the standard itself, and hypervisors export the supplementary information
+in non-standard extensions.
+
+Besides the problem of format, importing disk images from other hypervisors
+may fail if the emulated hardware changes too much from one hypervisor to
+another. Windows VMs are particularly concerned by this, as the OS is very
+picky about any changes of hardware. This problem may be solved by
+installing the MergeIDE.zip utility available from the Internet before exporting
+and choosing a hard disk type of *IDE* before booting the imported Windows VM.
+
+Finally there is the question of paravirtualized drivers, which improve the
+speed of the emulated system and are specific to the hypervisor.
+GNU/Linux and other free Unix OSes have all the necessary drivers installed by
+default and you can switch to the paravirtualized drivers right after importing
+the VM. For Windows VMs, you need to install the Windows paravirtualized
+drivers by yourself.
+
+GNU/Linux and other free Unix can usually be imported without hassle. Note
+that we cannot guarantee a successful import/export of Windows WM in all
+cases due to the problems above.
+
+Step-by-step example of a Windows disk image import
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Microsoft provides
+https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/[Virtual Machines exports]
+ in different formats for browser testing. We are going to use one of these to
+ demonstrate a VMDK import.
+
+Download the export zip
+^^^^^^^^^^^^^^^^^^^^^^^
+
+After getting informed about the user agreement, choose the _Microsoft Edge on
+Windows 10 Virtual Machine_ for the VMware platform, and download the zip.
+
+Extract the disk image from the zip
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Using the unzip utility or any archiver of your choice, unpack the zip,
+and copy via ssh/scp the vmdk file to your {pve} host.
+
+Create a new virtual machine and import the disk
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Create a virtual machine with 2 cores, 2GB RAM, and one NIC on the default
++vmbr0+ bridge:
+
+ qm create 999 -net0 e1000,bridge=vmbr0 -name Win10 -memory 2048 -bootdisk sata0
+
+Import the disk image to the +local-lvm+ storage:
+
+ qm importdisk 999 MSEdge "MSEdge - Win10_preview.vmdk" local-lvm
+
+The disk will be marked as *Unused* in the VM 999 configuration.
+After that you can go in the GUI, in the VM *Hardware*, *Edit* the unused disk
+and set the *Bus/Device* to *SATA/0*.
+The VM is ready to be started.
+
+
 Managing Virtual Machines with `qm`
 ------------------------------------
 
@@ -492,9 +732,10 @@ create and delete virtual disks.
 CLI Usage Examples
 ~~~~~~~~~~~~~~~~~~
 
-Create a new VM with 4 GB IDE disk.
+Using an iso file uploaded on the 'local' storage, create a VM
+with a 4 GB IDE disk on the 'local-lvm' storage
 
- qm create 300 -ide0 4 -net0 e1000 -cdrom proxmox-mailgateway_2.1.iso
+ qm create 300 -ide0 local-lvm:4 -net0 e1000 -cdrom local:iso/proxmox-mailgateway_2.1.iso
 
 Start the new VM