Proxmox VE web ui上调整虚拟机磁盘大小只能增加,不能减小
如果想减小空间设置,需要通过命令行调整
即是调整LV的大小,命令操作如下
先通过 lvs 命令查看虚拟机所设置的空间大小
root@xxxx:~# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
data pve twi-aotz-- <817.68g 0.00 0.23
root pve -wi-ao---- 96.00g
swap pve -wi-ao---- 7.00g
vm-100-disk-0 pve Vwi-aotz-- 34.00g data 0.00
然后执行 lvdisplay 来查看具体路径,我这个的路径是 /dev/pve/vm-100-disk-0
执行下边的命令将空间大小减小2G
root@xxxx:~# lvreduce -L -2G /dev/pve/vm-100-disk-0
WARNING: Reducing active and open logical volume to 32.00 GiB.
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce pve/vm-100-disk-0? [y/n]: y
Size of logical volume pve/vm-100-disk-0 changed from 34.00 GiB (8704 extents) to 32.00 GiB (8192 extents).
Logical volume pve/vm-100-disk-0 successfully resized.
root@xxxx:~# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
data pve twi-aotz-- <817.68g 0.00 0.23
root pve -wi-ao---- 96.00g
swap pve -wi-ao---- 7.00g
vm-100-disk-0 pve Vwi-aotz-- 32.00g data 0.00