VMs Disk Space and Performance Optimizations
On this page
There are a few tweaks in Proxmox that you might not think about but are very important for VM disk optimizations. Trimming is super important as it will considerably shrink down your backup sizes due to empty sectors being correctly discarded.
Some settings might be shared between OSes, however there are a few specific settings you’ll have to set differently for Windows Machines.
Linux VMs
First let’s check the Linux use case scenario. Here it’s a bit more simple:
Set the VM disks to VirtIO SCSI (NOT VirtIO BLOCK) and toggle the Discard and the IO Thread options/checkboxes.
Inside the VM enable the fstrim service in Systemd.
sudo systemctl enable fstrim.timer
sudo systemctl start fstrim.timer
- Once you’ve done that manually run the fstrim command
sudo fstrim -av
- If your VM is old(ish) or has seen some use it might take a bit trimming sectors.
Windows VMs
Requirements: Download the Latest Stable VirtIO Drivers ISO (for Windows)
In Windows VMs the principle is the same, set the disks to VirtIO SCSI, however you must first install the appropriate drivers in a specific way.
Boot up your VM and mount the downloaded VirtIO ISO onto the VM’s CD/DVD Drive.
Then add a small (e.g.: 1 GB) VirtIO SCSI Disk to the VM.
Press [WIN] + R and write devmgmt.msc to open the Device Manager service console.
There you’ll find a disk (the one you just added) without proper drivers and a warning sign, right-click it and do Install/Update Drivers.
Select the drivers on the ISO under the relative path: .\vioscsi\(your Windows version)\amd64
After that you’ll want to shutdown the VM.
Once the VM shuts down detach both disks (feel free to delete the 1GB disk).
Re-attach the original disk as a VirtIO SCSI drive with SSD Emulation, Discard, IO Thread and Writeback Cache ON.
Test boot (If the boot doesn’t work roll-back the changes).
After it boots run a disk trim from the “Defragment and Optimize Drives” Application in your Windows VM.