[SOLVED] space occupied by VM disk

martin8

Member
Mar 24, 2021
2
0
6
35
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!