Proxmox
Install QEMU guest agent (Windows)
- Mount the virtio-win.iso and install
D:\guest-agent\qemu-ga-x86_64.msi
- Shutdown the system.
- On the Proxmox system, head to Options > QEMU Guest Agent > Use QEMU Guest Agent (tick the box)
- Power up the VM
- Open devmgmt.msc - look for PCI Simple Communications Controller and right-click it, then click Update Driver
- Select Browse my computer for drivers and feed it the path of
D:\vioserial\YOUR-WINDOWS-VERSION\amd64\
- Per Proxmox docs, check if the service is running in PowerShell:
Get-Service QEMU-GA
- Additionally, from Proxmox command line you can run
qm agent xxx ping
to make sure an empty prompt is returned back (if you get QEMU guest agent is not running start at step 1 and double check everything).
Network connectivity issues for Linux VMs tagged with VLANs
I had a super frustrating problem where after moving Linux VMs from one host to another, they weren't pulling DHCP or not able to route traffic or both. This post and ChatGPT nudged me towards making a /etc/netplan/01-netcfg.yaml
file that looks something like this:
network:
ethernets:
ens18:
dhcp4: true
ens19:
dhcp4: true
version: 2
Once I did that and then sudo netplan apply
the DHCP addresses got pulled and routing worked!
QM command cheat sheet
Unlock a system (that might be locked from snapshot)
qm unlock XXX
List machines
qm list
Check status on if a particular machine is booted
qm status xxx
Get full info on one VM - like if autoboot is set, hardware info, etc:
qm config xxx
Enable autoboot (if onboot does not = 1 from `qm config X')
qm set X -onboot 1
Change boot order
qm set X --startup order=2,up=60
Stop a VM
qm stop X
Take a snapshot
qm snapshot xxx NAME-OF-SNAP --description
List snapshots
qm listsnapshot xxx
Restore a snapshot
qm rollback xxx NAME-OF-SNAP
Start a VM
qm start X
Bring network link up or down
qm set VMID -net0 virtio=THE:MAC:ADDRESS:OF:THE:PC,bridge=vmbr1,link_down=1,tag=10
Run a powershell command directly against a specific VM
qm guest exec xxx -- cmd /c "dir c:\users\administrator\desktop"
Another example of downloading and then running a PowerShell script
qm guest exec 100 -- cmd /c "powershell invoke-webrequest https://somesite/script.ps1 -outfile c:\users\administrator\desktop\script.ps1"
qm guest exec 100 -- cmd /c "powershell.exe -ExecutionPolicy Bypass -File "C:\\Users\\administrator\\Desktop\\script.ps1""
Yet another rexample of installing NIC driver on a fresh Windows build
qm guest exec 100 -- cmd /c "pnputil /add-driver d:\NetKVM\w11\amd64\netkvm.inf /install"
Yet ANOTHER example of installing Chrome
qm guest exec 100 -- cmd /c "powershell Invoke-WebRequest 'https://dl.google.com/chrome/install/chrome_installer.exe' -OutFile c:\users\ttadmin\desktop\chrome_installer.exe && c:\users\ttadmin\desktop\chrome_installer.exe /silent /install"
Then tailing the last 10 lines of a log file
qm guest exec 100 -- cmd /c "powershell.exe -ExecutionPolicy Bypass -Command Get-Content -Path 'C:\\some\\path\\install.log' -Tail 10"
Check if qmagent is running
qm agent xxx ping
Delete/destroy a VM
qm destroy xxx
Backup a VM and move to another Proxmox node in a cluster
vzdump <vmid> --storage <storage_name> --mode snapshot
Then move to another node:
scp /path/to/backup/vzdump-qemu-<vmid>.vma root@<destination_node_ip>:/var/lib/vz/dump/
Then restore:
qmrestore /var/lib/vz/dump/backup.vma <vmid> --storage <target-storage>
Example
This will dump a snapshot of VM 121 to a file path like /var/lib/vz/dump/vzdump-qemu-121-2024_09_13-10_25_00.vma
vzdump 121 --storage local --mode snapshot
Now move to another node:
scp /var/lib/vz/dump/vzdump-qemu-121-2024_09_13-10_25_00.vma root@target.host.for.VM:/var/lib/vz/dump/
Now restore:
qmrestore /var/lib/vz/dump/vzdump-qemu-121-2024_09_13-10_25_00.vma 123 --storage local-lvm
In the example above, 123
is the VM ID you want to assign the imported host, and local-lvm
is the storage pool to restore to.
Resize a disk
Shutdown the affected VM, then check the details on the VM you want to resize:
qm config xxx
This will tell you what kind of hard drive type (like virtio0
) you have
To do the resize and grow the disk by 20G:
qm resize 100 virtio0 +20G
Add memory (RAM) to a system
For example, upgrade RAM to 8192:
qm stop (VMID)
qm set (VMID) -memory 8192