[SOLVED] Disk usage different than VM usage

saulotarsobc

New Member
Mar 23, 2022
2
0
1
This vm 109 has a 480GB disk and the lvs command returns saying that it is using 51.52% (247.3 GB).

But when I access the vm and run a df -h it says it's only 87gb.

Why is this happening?

root@pve:~# ./discos df -h ######################## Filesystem Size Used Avail Use% Mounted on udev 63G 0 63G 0% /dev tmpfs 13G 18M 13G 1% /run /dev/mapper/pve-root 94G 2.3G 87G 3% / tmpfs 63G 43M 63G 1% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 63G 0 63G 0% /sys/fs/cgroup /dev/sda2 511M 324K 511M 1% /boot/efi /dev/fuse 30M 20K 30M 1% /etc/pve tmpfs 13G 0 13G 0% /run/user/0 vgs ######################## VG #PV #LV #SN Attr VSize VFree pve 1 11 0 wz--n- <837.25g 15.99g lvs ######################## LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert data pve twi-aotz-- 702.90g 99.06 4.96 root pve -wi-ao---- 96.00g swap pve -wi-ao---- 8.00g vm-100-disk-0 pve Vwi-aotz-- 480.00g data 4.63 vm-102-disk-0 pve Vwi-aotz-- 100.00g data 27.14 vm-103-disk-0 pve Vwi-aotz-- 200.00g data 91.94 vm-104-disk-0 pve Vwi-aotz-- 100.00g data 23.04 vm-107-disk-0 pve Vwi-aotz-- 700.00g data 18.06 vm-108-disk-0 pve Vwi-aotz-- 480.00g data 9.58 vm-109-disk-0 pve Vwi-aotz-- 480.00g data 51.52 vm-110-disk-0 pve Vwi-aotz-- 120.00g data 16.91 root@pve:~#

photo_2022-04-13_17-25-49.jpg

VM 109 'df -h'

9433d86c-8b89-464e-a0fb-49e139b7d836.png
 
Yeah, free space is not the same free space anywhere. The OS reports "free" as in "can be used" and the Hypervisor reports "free" as in "has never been used". You need to explicitely free the space by running e.g. fstrim -va. Even that will not free every possible block, because of different blocks to begin with. LVM normally has 1 or 2 MB extends and only free extends are counted as free, if there exist one filesystem block of 4K, the extend is not free for LVM anymore.... so space is really complicated in virtualized environments.
 
Yeah, free space is not the same free space anywhere. The OS reports "free" as in "can be used" and the Hypervisor reports "free" as in "has never been used". You need to explicitely free the space by running e.g. fstrim -va. Even that will not free every possible block, because of different blocks to begin with. LVM normally has 1 or 2 MB extends and only free extends are counted as free, if there exist one filesystem block of 4K, the extend is not free for LVM anymore.... so space is really complicated in virtualized environments.
Thank you. Your answer gave me a direction to follow and I found the solution. :)

On the disk of each virtual machine I enabled the DISCARD function, restarted the machines and ran the command 'fstrim /'. This command discards blocks that are not in use by the file system from mounted disks.

Tips from the Telegram staff lol
https://t.me/ProxmoxBrasil/151428

And this video on youtube
https://youtu.be/acuRrmRFmJk

In the end, what seemed to be at 99% usage is not even at 50% yet lol

HISTORY END
 

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!