[SOLVED] vm disk is larger than configured and crashing the system

tilor

New Member
Apr 9, 2025
2
0
1
Hi,

I created a VM with disk siz=1720G. The Physical drive is a 2TB SSD. It shows in Proxmox havin 1.97TB. The VM disk size grow over 1720G und is unsing up now the hole disk. It effective size shows as 1.97TB and
$ du
retuns
Code:
4       ./dump
4       ./private
16      ./lost+found
4       ./template/iso
4       ./template/cache
12      ./template
4       ./snippets
1921664032      ./images/101
1921664036      ./images
1921664080      .

Why could it get larger than 1720GB?
Any hints how to cut is back?

thanks,
Tilor
 
Size Discrepancy

The numbers don't line up exactly, but you may be seeing a Gigabyte vs Gibibyte vs Terabyte vs Tebibyte issue.

1720 GiB = 1.85 TB
1.72 TiB = 1.89 TB

Then throw in some book-keeping surrounding the QCOW format, and that probably gets you there.

Some GUIs and commands use the one metric, others use the other metric. It's just an annoying thing that happens.

Reducing Disk Usage

As for how to cut it back, it depends on the storage, but you'll want to:
  1. Enable Thin Provisioning in Datacenter Storage
  2. Enable Discard and SSD Emulation on the VM Hard Drive
  3. (optional) Qemu Guest Agent
  4. Reboot the VM
  5. Run `sudo fstrim /` in the VM

Screenshot 2025-04-08 at 9.28.45 PM.png
Screenshot 2025-04-08 at 9.32.09 PM.png
Screenshot 2025-04-08 at 9.35.55 PM.png
After that, significant space should be freed up from the Host.

Qemu Agent

Qemu Guest Agent isn't required to be installed at this step, but when you do it will also give you the ability to run fstrim if moving the VM disk or from the command line on the host.

Screenshot 2025-04-08 at 9.36.26 PM.png
Cloud images often include the Qemu Guest Agent, or you can install it:

sudo apt install -y qemu-guest-agent

See also: https://pve.proxmox.com/wiki/Qemu-guest-agent#Guest
 
Last edited:
  • Like
Reactions: UdoB and tilor
Awesome, thanks for the detailed answer.
I guess I first need to move my VM to another storage and the wipe the original SSD and configure it as ZFS thin-provisioning as described by you.

Thanks for the answer much appreciated.
 
Awesome, thanks for the detailed answer.

You're welcome.

I guess I first need to move my VM to another storage and the wipe the original SSD and configure it as ZFS thin-provisioning as described by you.
Thin provisioning also works with LVM and Ceph RDB. Even if you don't see the explicit option in datacenter for your storage, if it's one of the Proxmox-native block storage mechanisms, it should work.