VM Management
Basic VM Operations
# Start VM
qm start <vmid>
# Stop VM
qm stop <vmid>
# Reset VM
qm reset <vmid>
# Shutdown VM
qm shutdown <vmid>
VM Creation
# Create new VM
qm create <vmid> \
--memory 2048 \
--cores 2 \
--name vm-name \
--net0 virtio,bridge=vmbr0
# Clone VM
qm clone <source-vmid> <target-vmid> \
--name new-vm-name
VM Configuration
# Set memory
qm set <vmid> --memory 4096
# Set CPU cores
qm set <vmid> --cores 4
# Add hard disk
qm set <vmid> \
--scsi0 local-lvm:32
Storage Management
Storage Operations
# List storage
pvesm list
# Add storage
pvesm add <type> <storage> \
--path /path/to/storage
# Remove storage
pvesm remove <storage>
Backup Operations
# Create backup
vzdump <vmid> \
--compress zstd \
--mode snapshot
# Restore from backup
qmrestore backup.vma.zst <vmid> \
--storage local
Network Configuration
Bridge Management
# Create bridge
pve-bridge create \
--name vmbr0 \
--address 192.168.1.1/24
# Delete bridge
pve-bridge delete vmbr0
Interface Configuration
# Set interface
ip addr add 192.168.1.1/24 \
dev vmbr0
# Show interfaces
ip addr show
Cluster Management
Cluster Operations
# Create cluster
pvecm create <clustername>
# Join cluster
pvecm add <host>
# Show status
pvecm status
Node Management
# List nodes
pvecm nodes
# Remove node
pvecm delnode <node>
# Expected votes
pvecm expected <votes>
Resource Management
CPU Management
# Show CPU info
pvenode cpu-info
# Set CPU units
qm set <vmid> --cpu-units 2000
Memory Management
# Show memory usage
pvenode status
# Set memory limit
qm set <vmid> \
--memory 2048 \
--balloon 1024
Container Management
Container Operations
# Create container
pct create <ctid> template.tar.gz \
--hostname container1 \
--memory 512
# Start container
pct start <ctid>
Container Configuration
# Set resources
pct set <ctid> \
--cores 2 \
--memory 1024
# Mount points
pct set <ctid> \
--mp0 /mnt,mp=/mnt
Maintenance
System Updates
# Update repositories
apt update
# Upgrade system
apt dist-upgrade
# Install updates
pveupgrade
Backup Management
# Configure backup
pvesr create-backup-job \
--vmid <vmid> \
--schedule "0 2 * * *"
# List backup jobs
pvesr list
In detailed
VM Management
Basic VM Operations
# Start VM
qm start <vmid>
# Stop VM (force stop)
qm stop <vmid>
# Graceful shutdown
qm shutdown <vmid>
# Reset VM (hard reset)
qm reset <vmid>
# Suspend VM
qm suspend <vmid>
# Resume VM
qm resume <vmid>
# Send reboot command
qm reboot <vmid>
# Enter VM console
qm terminal <vmid>
# Show VM status
qm status <vmid>
VM Creation and Templates
# Create new VM
qm create <vmid> \
--memory 2048 \
--cores 2 \
--name vm-name \
--net0 virtio,bridge=vmbr0 \
--scsihw virtio-scsi-pci \
--scsi0 local-lvm:32 \
--bootdisk scsi0 \
--ostype l26 \
--sockets 1
# Create VM from template
qm clone <template-vmid> <target-vmid> \
--name new-vm-name \
--full \
--storage local-lvm
# Convert VM to template
qm template <vmid>
# Create linked clone
qm clone <template-vmid> <target-vmid> \
--name linked-clone \
--full 0
Advanced VM Configuration
# CPU configuration
qm set <vmid> \
--cores 4 \
--sockets 2 \
--cpu host \
--numa 1 \
--cpulimit 2
# Memory management
qm set <vmid> \
--memory 8192 \
--balloon 4096 \
--shares 2048
# Network configuration
qm set <vmid> \
--net0 virtio,bridge=vmbr0,rate=100 \
--net1 virtio,bridge=vmbr1,tag=10 \
--ipconfig0 ip=dhcp \
--ipconfig1 ip=10.0.0.100/24,gw=10.0.0.1
# Disk operations
qm set <vmid> \
--scsi0 local-lvm:32,ssd=1 \
--scsi1 local-lvm:64,backup=0 \
--ide2 local:iso/os-image.iso,media=cdrom
# Resource limits
qm set <vmid> \
--cpuunits 2048 \
--swap 4096 \
--onboot 1 \
--startup order=1,up=120
VM Migration and Replication
# Migrate VM to another node
qm migrate <vmid> <target-node> \
--online \
--with-local-disks
# Configure replication
qm set <vmid> \
--replication 1 \
--replication-target node2 \
--replication-job-schedule "*/15 * * * *"
# Start replication
qm replicate-start <vmid>
# Show replication status
qm replicate-status <vmid>
Storage Management
Storage Pool Operations
# List all storage pools
pvesm list
# Show storage details
pvesm status
# Add LVM storage
pvesm add lvm <name> \
--vgname vg0 \
--content images,rootdir
# Add NFS storage
pvesm add nfs <name> \
--path /mnt/nfs \
--server 192.168.1.100 \
--export /export \
--content backup,images
# Add CIFS storage
pvesm add cifs <name> \
--server 192.168.1.100 \
--share backup \
--username user \
--password pass
# Remove storage
pvesm remove <storage>
Volume Management
# List volumes
pvesm scan <storage>
# Create volume
pvesm alloc <storage> <vmid> \
images 32G
# Remove volume
pvesm free <volume>
# Resize volume
pvesm resize <volume> +10G
# Move volume
pvesm move <source-vol> <target-vol>
Backup and Restore
# Create backup
vzdump <vmid> \
--compress zstd \
--mode snapshot \
--maxfiles 5 \
--storage backup \
--node node1
# Scheduled backup
vzdump *(all VMs) \
--compress zstd \
--mailto [email protected] \
--exclude-vmid 100,101 \
--pigz 1 \
--ionice 3
# Restore from backup
qmrestore backup.vma.zst <vmid> \
--storage local-lvm \
--force \
--unique \
--target node1
# List backups
pvesr list-backup-archives
Network Configuration
Bridge Management
# Create bridge
pve-bridge create \
--name vmbr0 \
--address 192.168.1.1/24 \
--gateway 192.168.1.1 \
--vlan-aware yes
# Configure existing bridge
pve-bridge set vmbr0 \
--address 192.168.2.1/24 \
--ports eth0 \
--stp on \
--fd 15
# Delete bridge
pve-bridge delete vmbr0
# Show bridge status
pve-bridge status vmbr0
VLAN Configuration
# Create VLAN interface
ip link add link vmbr0 name vmbr0.10 \
type vlan id 10
# Configure VLAN
ip addr add 10.0.10.1/24 \
dev vmbr0.10
# Create VLAN-aware bridge
pve-bridge create \
--name vmbr1 \
--vlan-aware yes \
--vlan-allowed 1-4094
# Assign VLANs to VM
qm set <vmid> \
--net0 virtio,bridge=vmbr1,tag=10 \
--net1 virtio,bridge=vmbr1,tag=20
Advanced Networking
# Configure bonding
pve-create-bond \
--name bond0 \
--slaves eth0,eth1 \
--mode 802.3ad \
--hash-policy layer2+3
# Setup traffic control
tc qdisc add dev vmbr0 \
root handle 1: htb default 10
# Configure firewall
pve-firewall set \
--enable 1 \
--policy_in DROP \
--policy_out ACCEPT
# Create firewall rules
pve-firewall add \
--action ACCEPT \
--source 192.168.1.0/24 \
--dest 192.168.2.0/24 \
--proto tcp \
--dport 22
References
- Based on Proxmox VE 8.0
- For more details: Proxmox Documentation
0 Comments for this cheatsheet. Write yours!