Skip to content

Proxmox

Is a Supervisor Operating System

Setup

  • In VirtualBox: see the guide
  • Remove Subscription notice with pve-nag-buster
    • wget https://raw.githubusercontent.com/foundObjects/pve-nag-buster/master/install.sh && chmod +x install.sh && ./install.sh
    • Then disable the entreprise repository
  • Trove of scripts
    • Change CPU Scaling Governor to powersave to save some previous Watts
    • Clean old kernels
  • SSH port shouldn't be changed as it is used for cluster things

Activate IOMMU / PCIe Passthrough

Import a VM from TrueNAS SCALE

  • Disk copy
    • Copy the raw file from TrueNAS to Proxmox - ZFS with dd
    • Import the raw file with qm importdisk <VMID> /path/to/file.raw local --format qcow2
    • Attach the disk to the VM with VirtIO
  • Other settings from TrueNAS
    • Boot loader: UEFI
    • Display: SPICE

USB Passthrough

  • The order of creation of passthrough does matter, like for Home Assistant

Remote SPICE access without going through Web GUI

  • Set up permissions
    • New role with VM.Console, VM.Audit
    • New group
    • New permission for the group with the role and the necessary path
    • New user in the PVE realm assigned to the group
  • Set up token
    • Create API Token, with Privilege Separation
    • In each VM, assign the API token to the Role created
  • Choose a script option

Configure ZFS settings

Limit ZFS Memory usage

Serial Console

  • Add Serial device to the VM
  • Edit /etc/default/grub with
GRUB_CMDLINE_LINUX="console=ttyS0,115200n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
  • Run update-grub

Utilization

Best settings when creating a VM

  • Windows 10 guest best practices
  • System
    • QEMU Agent: enabled
    • Machine type: q35 + BIOS: OVMF for PCI Passthrough, otherwise default is fine
  • CPU
    • Type:
      • x86-64-v3 works fine
      • host will match the Host CPU, but will impact migration to to other systems
  • Memory
    • Ballooning: enabled, disable on Windows
    • Minimum memory: don't use on Windows
    • 1 GB must be made available for the host
  • Network
    • Type: VirtIO
  • Display
    • Type: std or qxl for SPICE
  • Firmware
    • SeaBIOS by default
    • OVMF for Windows 11 and PCI Express
      • pre-enroll-key for Windows keys + Secure Boot on
      • Virtual screen resolution is set in the VM BIOS
  • Storage
    • Controller: VirtIO SCSI (source) single with IO Thread enabled
    • Image Format: raw disk image by default if you use LVM or ZFS
    • Cache: none (source)
      • writeback is faster, but can result in data lose
    • Discard: enabled + SSD emulation: enabled, to let the OS TRIM
    • IO Thread: enabled
  • For Windows

Stop a VM

  • Shutdown simulate an ACPI power off
  • Stop simulate a sudden stops, like a power loss
  • qm stop <VMID> with VMID the ID in Proxmox
  • ps aux | grep <VMID> to grab the VM's process ID
  • kill -9 <PID> to kill the process

Mount a USB drive

  • Mount the drive with fstab
  • In the Proxmox interface, add the disk as a Directory

Shrink a VM Disk

  • Make sure that things are zeroed
    • Make sure that Discard is on
    • Resize a partition
  • Change the size (source)
    • If LV: lvreduce -L 5G /dev/pve/disk-name (reduce to 5G) or lvreduce -L -5G /dev/pve/disk-name (reduce by 5G)
    • If qcow2: qemu-img resize --shrink <vmfile.qcow2> [+-] or size
    • If ZFS: zfs set volsize=<new size>G rpool/data/vm-<vm id>-disk-<disk number>
      • Find the ZFS path with zfs list
  • Update Proxmox: qm rescan
  • If you use GUID Partition Table

Sources