A while ago, I had to reduce the size of a LVM thin volume. This volume was a virtual hard drive of a Proxmox VM. The original size was 488GB, but I only needed 30GB.
I don’t remember the exact steps I took, but I do know that I resized filesystem and the partition inside the VM, after which I reduced the disk in Proxmox. This all went well, the VM has been running for quite some time without issues.
Recently, I notice that Proxmox reported that the local-lvm of one of my nodes was almost full. There were not so much VM images on local-lvm, all having disks less than 50GB. Total space of local-lvm was 794G. Adding up the size of all VM images on that volume, I only counted 322G. I lost more than 50% !
After some investigation, I found out that the resizing of my 488GB disk did not work that well. This is what I found:
root@proxmox:~# lvs
WARNING: Thin volume pve/vm-103-disk-1 maps 488.28 GiB while the size is only 30.00 GiB.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
data pve twi-aotz-- <794.79g 80.59 4.18
root pve -wi-ao---- 96.00g
swap pve -wi-ao---- 8.00g
vm-101-disk-0 pve Vwi-aotz-- 50.00g data 16.15
vm-103-disk-0 pve Vwi-aotz-- 19.53g data 100.00
vm-103-disk-1 pve Vwi-aotz-- 30.00g data 100.00
vm-104-disk-0 pve Vwi-aotz-- 50.00g data 13.09
vm-105-disk-0 pve Vwi-aotz-- 20.00g data 100.00
vm-107-disk-1 pve Vwi-aotz-- 40.00g data 5.80
vm-113-disk-0 pve Vwi-aotz-- 12.00g data 97.97
vm-127-disk-0 pve Vwi-aotz-- 8.00g data 100.00
vm-129-disk-0 pve Vwi-aotz-- 32.00g data 100.00
vm-131-disk-0 pve Vwi-a-tz-- 10.00g data 27.37
vm-136-disk-0 pve Vwi-aotz-- 10.00g data 13.08
vm-138-disk-0 pve Vwi-aotz-- 40.00g data 100.00
I started looking for a solution, until I came across a thread on the ProxMox forum. This post suggested to backup the VM, destroy it, and finally restore the backup. Since I had been searching and trying to fix this problem for quite some time, I gave the backup-destroy-restore idea a go. Result: bingo! The thin volume now corretly reports 30G:
root@proxmox:~# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert data pve twi-aotz-- <794.79g 22.11 1.31 root pve -wi-ao---- 96.00g swap pve -wi-ao---- 8.00g vm-101-disk-0 pve Vwi-aotz-- 50.00g data 16.15 vm-103-disk-0 pve Vwi-aotz-- 19.53g data 97.12 vm-103-disk-1 pve Vwi-aotz-- 30.00g data 80.04 vm-104-disk-0 pve Vwi-aotz-- 50.00g data 13.09 vm-105-disk-0 pve Vwi-aotz-- 20.00g data 100.00 vm-107-disk-1 pve Vwi-aotz-- 40.00g data 5.80 vm-113-disk-0 pve Vwi-aotz-- 12.00g data 97.97 vm-127-disk-0 pve Vwi-aotz-- 8.00g data 100.00 vm-129-disk-0 pve Vwi-aotz-- 32.00g data 100.00 vm-131-disk-0 pve Vwi-a-tz-- 10.00g data 27.37 vm-136-disk-0 pve Vwi-aotz-- 10.00g data 13.08
And I have my free diskspace back:
Thanks a lot Gareth!