Virtual Machine Management
Complete guide to creating, configuring, and managing VMs in Proxmox VE
Virtual Machine Management
Proxmox VE provides powerful VM management capabilities with support for various operating systems and advanced features like snapshots, migration, and high availability.
Creating Virtual Machines
VM Creation Wizard
-
Node → Create VM
-
General Tab:
- VM ID: Unique identifier (100-999999)
- Name: Descriptive VM name
- Resource Pool: Optional organization
-
OS Tab:
- ISO Image: Select installation media
- Guest OS Type: Linux, Windows, or Other
-
System Tab:
- Machine: q35 (recommended)
- BIOS: OVMF (UEFI) or SeaBIOS
- SCSI Controller: VirtIO SCSI single
-
Hard Disk Tab:
- Storage: Select storage location
- Disk Size: Allocate appropriate space
- Format: qcow2 or raw
-
CPU Tab:
- Sockets/Cores: Configure CPU allocation
- Type: host or kvm64
-
Memory Tab:
- Memory: RAM allocation in MB
- Ballooning: Enable for dynamic allocation
-
Network Tab:
- Bridge: vmbr0 (default)
- Model: VirtIO (paravirt)
# Create VM with basic configuration
qm create 100 \
--name "ubuntu-server" \
--memory 2048 \
--cores 2 \
--net0 virtio,bridge=vmbr0 \
--scsi0 local-lvm:32 \
--ide2 local:iso/ubuntu-22.04.iso,media=cdrom \
--boot order=ide2 \
--ostype l26
# Start VM
qm start 100VM Templates
Create reusable VM templates:
Templates save time and ensure consistent VM configurations across your infrastructure.
- Install and configure base VM
- Clean up (remove logs, SSH keys, etc.)
- Shutdown VM
- Convert to template:
qm template 100 - Clone from template:
qm clone 100 101 --name new-vm
VM Configuration
Hardware Configuration
CPU Types:
- host: Best performance, limited migration
- kvm64: Good compatibility
- Haswell/Broadwell: Specific CPU features
Advanced Options:
# Enable CPU hotplug
qm set 100 --hotplug cpu,memory,disk,network
# Set CPU limit (50% of host)
qm set 100 --cpulimit 0.5
# NUMA configuration
qm set 100 --numa 1Memory Types:
- Static: Fixed allocation
- Ballooning: Dynamic allocation
- Shares: Priority weighting
# Set memory with ballooning
qm set 100 --memory 4096 --balloon 2048
# Memory shares (higher = more priority)
qm set 100 --shares 1000Disk Controllers:
- VirtIO SCSI: Best performance
- SATA: Good compatibility
- IDE: Legacy support
# Add additional disk
qm set 100 --scsi1 local-lvm:50
# Enable SSD emulation
qm set 100 --scsi0 local-lvm:vm-100-disk-0,ssd=1
# Enable discard for thin provisioning
qm set 100 --scsi0 local-lvm:vm-100-disk-0,discard=onNetwork Configuration
# Configure network with VLAN
qm set 100 --net0 virtio,bridge=vmbr0,tag=100
# Enable multiqueue (cores/2, max 8)
qm set 100 --net0 virtio,bridge=vmbr0,queues=4
# Set bandwidth limit (10 Mbps)
qm set 100 --net0 virtio,bridge=vmbr0,rate=10VM Operations
Basic Operations
# Start VM
qm start 100
# Shutdown VM (graceful)
qm shutdown 100
# Stop VM (force)
qm stop 100
# Reboot VM
qm reboot 100
# Suspend VM
qm suspend 100
# Resume VM
qm resume 100Console Types:
- noVNC: Web-based console
- SPICE: Enhanced graphics protocol
- Serial: Text-based console
# Access via command line
qm terminal 100
# VNC console
qm vncproxy 100
# Monitor console
qm monitor 100Live Migration:
# Migrate to another node
qm migrate 100 proxmox-node2
# Migrate with specific options
qm migrate 100 proxmox-node2 --online --with-local-disksOffline Migration:
# Migrate stopped VM
qm migrate 100 proxmox-node2 --with-local-disksSnapshot Management
Snapshots capture VM state at a specific point in time, enabling quick rollbacks and testing scenarios.
# Create snapshot
qm snapshot 100 pre-update --description "Before system update"
# List snapshots
qm listsnapshot 100
# Rollback to snapshot
qm rollback 100 pre-update
# Delete snapshot
qm delsnapshot 100 pre-updateBackup and Restore
# Create backup
vzdump 100 --storage local-backup --mode snapshot --compress gzip
# Backup with specific options
vzdump 100 --storage nfs-backup --mode suspend --exclude-path /tmp --exclude-path /var/logVia web interface:
- Datacenter → Backup
- Add backup job
- Configure VMs, schedule, and retention
Via command line:
# Edit crontab
crontab -e
# Add backup job (daily at 2 AM)
0 2 * * * vzdump --all --storage local-backup --mode snapshot --quiet 1# List available backups
ls /var/lib/vz/dump/
# Restore VM
qmrestore /var/lib/vz/dump/vzdump-qemu-100-2024_02_09-02_00_15.vma.gz 101
# Restore with different storage
qmrestore /var/lib/vz/dump/vzdump-qemu-100-2024_02_09-02_00_15.vma.gz 101 --storage local-lvmAdvanced VM Features
Cloud-Init Integration
Cloud-Init enables automated VM provisioning with custom configurations, SSH keys, and network settings.
# Add Cloud-Init drive
qm set 100 --ide2 local-lvm:cloudinit
# Configure Cloud-Init settings
qm set 100 --ciuser ubuntu --cipassword secure123 --sshkey ~/.ssh/id_rsa.pub --ipconfig0 ip=192.168.1.100/24,gw=192.168.1.1
# Resize disk after clone
qm resize 100 scsi0 +10GGPU Passthrough
Prerequisites:
- IOMMU enabled in BIOS
- GPU in separate IOMMU group
# Enable IOMMU
echo 'GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"' >> /etc/default/grub
update-grub
# Blacklist GPU driver
echo 'blacklist nouveau' >> /etc/modprobe.d/blacklist.conf
# Add GPU to VM
qm set 100 --hostpci0 01:00,pcie=1,x-vga=1USB Passthrough
# List USB devices
lsusb
# Add USB device to VM
qm set 100 --usb0 host=1234:5678
# Add USB port
qm set 100 --usb1 host=1-2Performance Optimization
CPU Optimization
# CPU pinning (cores 2-3 to VM)
qm set 100 --cpus 2 --affinity 2,3
# NUMA configuration
qm set 100 --numa 1 --cpus 4 --memory 8192Memory Optimization
# Disable memory ballooning for performance
qm set 100 --balloon 0
# Enable huge pages
echo 'vm.nr_hugepages = 1024' >> /etc/sysctl.conf
qm set 100 --hugepages 1024Storage Optimization
# Use VirtIO SCSI with multiple queues
qm set 100 --scsi0 local-lvm:vm-100-disk-0,iothread=1,queues=4
# Enable write-back cache for performance
qm set 100 --scsi0 local-lvm:vm-100-disk-0,cache=writeback
# Disable cache for safety
qm set 100 --scsi0 local-lvm:vm-100-disk-0,cache=noneTroubleshooting
Common Issues
Always create snapshots before making significant changes to VMs.
VM Won't Start:
# Check VM configuration
qm config 100
# Check system resources
free -h
df -h
# Check logs
journalctl -u qemu-server@100Performance Issues:
# Monitor VM performance
qm monitor 100
info cpus
info memory
info block
# Check host resources
top
iostat -x 1Network Issues:
# Check bridge configuration
brctl show
# Test network connectivity
ping -c 4 gateway_ip
# Check firewall rules
iptables -LBest Practices
- Resource Planning: Don't over-allocate CPU and memory
- Regular Backups: Implement automated backup strategies
- Monitoring: Set up performance and resource monitoring
- Security: Keep guest OS and Proxmox updated
- Documentation: Maintain VM inventory and configurations
- Testing: Test snapshots and backups regularly
Proper VM management ensures optimal performance, reliability, and maintainability of your virtualized infrastructure.