VMs Disk Space and Performance Optimizations

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:

  1. Set the VM disks to VirtIO SCSI (NOT VirtIO BLOCK) and toggle the Discard and the IO Thread options/checkboxes.

  2. Inside the VM enable the fstrim service in Systemd.

sudo systemctl enable fstrim.timer
sudo systemctl start fstrim.timer
  1. Once you’ve done that manually run the fstrim command
sudo fstrim -av
  1. 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.

  1. Boot up your VM and mount the downloaded VirtIO ISO onto the VM’s CD/DVD Drive.

  2. Then add a small (e.g.: 1 GB) VirtIO SCSI Disk to the VM.

  3. Press [WIN] + R and write devmgmt.msc to open the Device Manager service console.

  4. 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.

  5. Select the drivers on the ISO under the relative path: .\vioscsi\(your Windows version)\amd64

  1. After that you’ll want to shutdown the VM.

  2. Once the VM shuts down detach both disks (feel free to delete the 1GB disk).

  3. Re-attach the original disk as a VirtIO SCSI drive with SSD Emulation, Discard, IO Thread and Writeback Cache ON.

  4. 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.