Virtual machines on Proxmox VE

A guide to understanding how virtual machines work on Proxmox VE.

Virtual machines on Proxmox VE
pve proxmox proxmoxve virtual machines virtuelles

Contents :

  • 1-Deepen your knowledge
  • 2-Virtual machine options

1-Deepen your knowledge

Let's take a look at the different options offered by Proxmox VE for configuring virtual machines.

To familiarize yourself with QEMU, KVM and virtualization under Linux, I suggest you read the following articles.

How fast is KVM? Host vs virtual machine performance!
So after we went through the guide on PCI passthrough, there is a question that was raised quite a bit: what exactly is the performance difference between running games in a VM vs running them natively on the host? This question has a much broader attachment to it; how well can KVM actually run a guest OS? What is the performance difference between the host and a virtual machine? I ran a slew of games and benchmarks to be able accurately represent a wide variety of performance measurements…
What is KVM?
Kernel-based virtual machines (KVM) are an open source virtualization technology that turns Linux into a hypervisor.

2-Virtual machine options

General

  • Node: if you have a cluster, choose the node that will host the virtual machine
  • Resource Pool: add the virtual machine to a resource pool (database pool, kubernetes pool, docker pool, etc.)
  • VM ID: the identifier of each virtual machine
  • Name: the name you wish to give to the virtual machine

Four options are often left as default:

  • Start at boot: as the name suggests, this allows you to start the virtual machine when the server boots (useful, for example, in the case of an office virtual machine with passthrough),
  • Startup/Shutdown delay: startup or shutdown delay,
  • Start/Shutdown order: virtual machine startup order.

OS

  • Use CD/DVD disc image file (iso): indicate where your ISOs are stored
  • Use physical CD/DVD Drive: if you have a physical drive, check this option
  • Do no use any media: no media will be loaded at startup
  • Guest OS: make sure you select the correct system and version in "Type" and "Version" for best performance and stability

System

  • Graphic card: I recommend leaving the default or using SPICE, which offers better performance than NoVNC and provides options such as drag'n'drop, remote device connection and audio sound (requires SPICE to be installed on the guest system).
  • Machine: two choices are available: i440fx or Q35. Q35 (combined with OVMF) is mandatory for Windows if you wish to use PCI passthrough, otherwise there's no reason to use it. The default choice is sufficient for Linux and BSD.
  • BIOS: Seabios is the equivalent of "Legacy" mode (default choice) and OVMF is the equivalent of UEFI. The latter is a port of Intel's tianocore firmware for QEMU. Use OVMF for Windows, especially if you want to assign a graphics card to it via PCI passthrough
  • SCSI Controller: VirtIO SCSI is the best possible choice (VirtIO Block is deprecated) and offers the best performance.
  • Qemu Agent: retrieves information from the Qemu client installed on the guest system. It requires prior installation on the guest system (included in VirtIO drivers).
  • Add TPM: encryption chip. PVE offers a workaround option for running Windows 11 without a physical TPM chip.

Disks

  • Bus/Device: your choices are SCSI, IDE, SATA. Choose SCSI, which offers the best performance under VirtIO (Virtio is deprecated), and use SATA or IDE if you want to use older systems.
  • Storage: the type of storage you wish to use. By default, you can choose between storing your virtual machine in the local partition (.qcow2 format) or in local-lvm (.raw format).
  • Disk size (Gib): this is where you allocate the disk space required by the virtual machine. For WIndows, for example, remember to allocate a minimum of 50 to 100 GB, because if you increase the volume, you won't be able to merge it with the previous volume.
  • Cache: this option is left by default, but on Windows it is recommended to choose the "write back" option.
  • Discard: activates FSTRIM mode, which reclaims disk space when you delete data, very useful on a LVM-thin or ZFS volume. If you're using the virtio or virtio-scsi controller, activate the
  • SSD emulation: tells the virtualized system that it's running on an SSD and not on a mechanical disk. Not necessary if you're using the virtio or virtio-scsi controller, as it's already built in.
  • IO thread: allows you to assign a thread to the virtual machine instead of waiting in a queue, which improves performance. This is a fairly recent feature, but you should test it before implementing it.
  • Read-only: indicate whether this volume will be read/written or read-only
  • Backup: indicate whether or not you want to add this volume when you make a backup of the virtual machine

CPU

  • Sockets: leave the default choice (1) if you have only one processor.
  • Cores: the number of cores you wish to allocate to the virtual machine. The best practice is to reduce the number of cores to the minimum to see what is the ideal number to allocate to the virtual machine, then increase gradually,
    VCPUs :
  • Type: For access to processor instructions, set CPU type to "Host". This mode is mandatory for Windows, because if you leave it in "kvm64", applications won't run. If you're looking for greater portability for your virtual machines (Linux, BSD), "kvm64" ensures maximum compatibility. Whether the processor is AMD or Intel, whether the server is old or ancient, the virtual machine won't notice a thing, because what it sees is the hypervisor with which it communicates (the abstraction layer) and not the underlying hardware.
  • CPU units: defines the minimum amount of CPU time. In the terminal, type "vzcpucheck" to check how many you have.
  • Enable NUMA: only used on multi-processor motherboards, so don't enable NUMA if you only have one socket. You can check NUMA status with the following command "numastat".

These options are generally never used and disabled by default. I'll give you a detailed description in due course.

Memory

  • Memory (Mib): this is where you allocate the virtual machine's RAM. Never over-provision or you risk bringing down the server.
  • Ballooning Device: the "ballooning" mechanism is designed to avoid over-provisioning virtual machines with RAM. Unused memory is detached from the virtual machine by the hypervisor and made available in a shared pool accessible to other virtual machines. Ballooning is activated once 80% of the server's RAM has been monopolized.
  • Minimum memory: linked to the "Ballooning Device" option. You need to specify the minimum amount of memory that will allow the guest system to function correctly with or without ballooning. For example, if you set 8192 Mib in "Memory" and 4096 Mib in "Minimum memory", KSM (Kernel same-page merging) will be able to draw on 4096 Mib and redistribute it in a share pool accessible to other virtual machines. However, if you set 8192/8192, ballooning is disabled. Disable ballooning for Windows virtual machines, as this option is notorious for causing instability and performance problems (for Linux, dynamic memory poses no problems).
Memory ballooning - Wikipedia
Dynamic Memory Management - Proxmox VE
Kernel same-page merging - Wikipedia
[SOLVED] Hyper-Threading vs No Hyper-Threading; Fixed vs Variable Memory
After reading countless discussions, articles, whitepapers and not finding suitable answer, I decided to take matter in hand and do some testing to come to conclusion, if i should be using Hyper-Threading or not. While trying to find this answer, i also found the answer of using Fixed or…

Network

  • Bridge: "Bridge" mode allows the virtual machine to connect to the network via a bridge (vmbr0 by default).
  • VLAN tag: if you wish to isolate the virtual machine in a subnet, specify the subnet number (see my article "Networking guide on Proxmox Virtual Environment").
  • Firewall: if enabled, this is based on iptable, the default firewall for Linux distributions. Disable it if you are virtualizing pfSense or OPNsense, otherwise packets will be processed twice. Similarly, when your virtual machines are connected to pfSense/OPNsense vlans, disable the firewall or leave it enabled, as this will apply the server's firewall rules to the virtual machines. Finally, if you wish to isolate the virtual machine,
  • Disconnect: disconnects the virtual machine's network card.
  • Model: several types of network card are available. PVE can emulate cards from Realtek, Intel and vmware. The most powerful and widely used is Virtio (requires driver installation on Windows, already installed on Linux and BSD). Use the Intel e1000 model for virtual machines that don't have access to VirtIO drivers (such as Batocera), but in any case, use the "VirtIO" model.
  • Mac address: indicates the MAC address of the virtual network card. By default, it's set to automatic, but you can set it to a fixed value yourself, especially if you have applications that manage access via MAC address.
  • Rate limit (Mb/s): you can limit the bandwidth of virtual machines with the "Rate Limit" option, useful if you have several virtual machines, some of which download,
  • Multiqueue: virtual machines are basically "single-queued", i.e. they receive packets one by one and not in parallel. You can activate the "multiqueue" mode, which allows virtual machines to receive packets in parallel, at the cost of a heavier processor load (more work for parallelization). This is recommended for virtual machines that serve as databases, web servers and anything else requiring heavy traffic. On the other hand, it's not advisable to over-allocate. For example, if a virtual machine has 4 cores, set the multi-queue value to 4. This will increase the virtual machine's network performance, so it's best to have sufficient bandwidth.

Sources :

Mastering Proxmox - Third Edition | Packt
Discover real world scenarios for Proxmox troubleshooting and become an expert cloud builder