There are several threads about not comfortable way how to shrink some VM (especially Win VM) with not clear results always.
This is my succesful way today.
I have 1TB VM Win2019 server but with only 90GB data in. I wanted to resize VM disk from 1TB to 500GB because there is waste time to backup or restore empty space.
Classic default Proxmox setup, local-lvm, VM with sata disk.
1st I tried to resize disk via lvreduce, then qm rescan.
But this way is wrong, VM cannot start correctly, automatic repair don`t fix the problem, maybe using cmd with bootrec can help...etc.
The right way is shrink disk in VM from 1000GB to 500GB in my case (465 in real for sure, because 500GB=465GB in win format). If you have a problem with shrink because not enough space, you have to turn off pagefile (12GB in my case, but remember i Have 880GB free space in Win!?), then restart, shrink some space, restart, shrink some space...I had to make 4 restarts from 100GB to 465GB...because Windows.
Then classic....lvm lvreduce -L - 500G disk and qm rescan...start the VM a server is running correctly again.
root@pve1:~# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
data pve twi-aotz-- 1.67t 5.54 0.35
root pve -wi-ao---- 96.00g
swap pve -wi-ao---- <7.53g
vm-100-disk-0 pve Vwi-aotz-- 500.00g data 18.95
This is my succesful way today.
I have 1TB VM Win2019 server but with only 90GB data in. I wanted to resize VM disk from 1TB to 500GB because there is waste time to backup or restore empty space.
Classic default Proxmox setup, local-lvm, VM with sata disk.
1st I tried to resize disk via lvreduce, then qm rescan.
But this way is wrong, VM cannot start correctly, automatic repair don`t fix the problem, maybe using cmd with bootrec can help...etc.
The right way is shrink disk in VM from 1000GB to 500GB in my case (465 in real for sure, because 500GB=465GB in win format). If you have a problem with shrink because not enough space, you have to turn off pagefile (12GB in my case, but remember i Have 880GB free space in Win!?), then restart, shrink some space, restart, shrink some space...I had to make 4 restarts from 100GB to 465GB...because Windows.
Then classic....lvm lvreduce -L - 500G disk and qm rescan...start the VM a server is running correctly again.
root@pve1:~# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
data pve twi-aotz-- 1.67t 5.54 0.35
root pve -wi-ao---- 96.00g
swap pve -wi-ao---- <7.53g
vm-100-disk-0 pve Vwi-aotz-- 500.00g data 18.95