What started as a project to run "some crypto applications" grew into something much bigger, but also more useful. I learned a tremendous amount about virtual machines, lxc containers and Proxmox. And although I'm just scratching the surface and I don't actually understand it, I know how to do some things. I'll write them down here, partly for myself, but also for you in hopes it will save one of us a lot of time and frustration.
Qemu guest are full virtual machines. You have to (can) specify a lot of details about the hardware and the OS will run as if it is a full machine.
When creating a guest (VM) some basic settings are:
Select "Start at boot" and set "Start/Shutdown order"
Set the correct "Guest OS". Proxmox will select the best defaults and lower level settings. Especially important when installing a Windows guest.
Select "Qemu Agent" and set "Machine" to
q35. (setting "Graphic card" to
VirtIO-GPU might solve some graphics related issues)
Select "Discard" and "SSD emulation" and set a proper "Disk size". The discard option will free up disk space on the host when files are deleted in the guest.
First set the number of "Sockets", "Cores" and "VCPUs". The number of vCPU's = Sockets x Cores. Only use multiple sockets if the host has multiple too. Set "Type" to
host. Lastly select "Enable NUMA" if the host machine has multiple sockets.
Set the amount of RAM. Use a ballooning device if you know the machine doesn't always use all of the RAM.
Select the network bridge that should be used by the guest
Confirm and finish
First thing to after installing a guest OS is installing the Qemu guest client to allow Proxmox to properly shutdown, snapshot and control the guest. It also gives you the guests network address in the Proxmox web interface.
virtio-win-0.1.185.isoto local storage on the host. Download: https://pve.proxmox.com/wiki/Qemu-guest-agent
sudo apt updatesudo apt install qemu-guest-agent
Prepare your VM disk for shrinking (defrag, clean files, shrink file system) and shut it down
Open a shellsession to the Proxmox node and set the new zfs pool size
zfs set volsize=<new size>G rpool/data/vm-<vm id>-disk-<disk number>
Open vm config
nano /etc/pve/local/qemu-server/<vm id>.conf
scsi0: local-zfs:vm-<vm id>-disk-<disk number>,size=<new size>G
Back in the Proxmox GUI change the cache mode to something else and then revert back, this should update the config.
LXC containers are light-weight alternatives to Qemu guests. They can be used to run a single application for example. See How to run a Docker in LXC container on ZFS on Proxmox, How to run a LXC container with snap on Proxmox and How to run a an AWS SMTP relay on Proxmox for examples.
Open a shellsession session to the host.
List the containers:
Stop the particular container you want to resize:
pct stop 999
Find out it's path on the node:
lvdisplay | grep "LV Path\|LV Size"
For good measure one can run a file system check:
e2fsck -fy /dev/pve/vm-999-disk-0
Resize the file system:
resize2fs /dev/pve/vm-999-disk-0 10G
Resize the local volume
lvreduce -L 10G /dev/pve/vm-999-disk-0
Edit the container's conf, look for the rootfs line and change accordingly:
rootfs: local-lvm:vm-999-disk-0,size=32G >> rootfs: local-lvm:vm-999-disk-0,size=10G
pct start 999