[SOLVED] space occupied by VM disk

martin8

Member
Mar 24, 2021
2
0
6
34
Hi, I am confused by the total occupied space of one of my VMs. Its a debian VM with maraidb in docker and lvs shows this

Code:
root@pve:~# lvs -a
  LV              VG  Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data            pve twi-aotz-- <151.63g             92.36  5.34                           
...
  vm-101-disk-0   pve Vwi-aotz--  300.00g data        28.46

so 300*0.28=84g occupied. But I believe the real occupied space is much smaller:

Code:
root@debian-docker-prod:~# du -shc /*
...
4.2G    /docker_volumes
336M    /root
8.6M    /run
1.4G    /usr
2.6G    /var
8.5G    total

no way that adds to 84g. How can I claim the unused space?
 
Did you ticked "discard" at the time you added the disk to the vm? And installed guest tools?

I don't know if this works with proxmox, but you could try to fill your guest diskspace with zeros, aka:
dd if=/dev/zero of=/root/deleteme bs=1024 count=10000000
But stop your sevices before... Docker mariadb etc...

Then delete the file, and simply move the storage to any other storage and back....

I think this should work, but didn't tested myself.
And don't forget to tick "discard"

Cheers
 
Thanks! Seems that checking "discard", rebooting VM and running fstrim --all did the trick!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!