Proxmox减少虚拟磁盘大小

Proxmox采用的是LVM模式,因此,采用lvm相关命令即可配置

查看lv信息

lvs

root@home:~# lvs
  LV                    VG       Attr       LSize    Pool     Origin        Data%  Meta%  Move Log Cpy%Sync Convert
  DISK3-4T              DISK3-4T twi-aotz--   <3.61t                        0.11   0.20                            
  vm-102-disk-0         DISK3-4T Vwi-aotz--    1.00t DISK3-4T               0.40                                   
  base-1000-disk-0      pve      Vri-a-tz-k   23.50g data                   19.49                                  
  base-1001-disk-0      pve      Vri---tz-k   20.00g data                                                          
  data                  pve      twi-aotz-- <245.98g                        11.54  1.00                            
  root                  pve      -wi-ao----   96.00g                                                               
  snap_vm-100-disk-0_A0 pve      Vri---tz-k   80.00g data     vm-100-disk-0                                        
  swap                  pve      -wi-ao----    8.00g                                                               
  vm-100-disk-0         pve      Vwi-a-tz--   80.00g data                   7.19                                   
  vm-1000-cloudinit     pve      Vwi-a-tz--    4.00m data                   9.38                                   
  vm-1001-cloudinit     pve      Vwi-a-tz--    4.00m data                   9.38                                   
  vm-101-disk-0         pve      Vwi-a-tz--  500.00g data                   2.20                                   
  vm-102-disk-0         pve      Vwi-aotz--    1.00g data                   89.87                                  
  vm-102-disk-1         pve      Vwi-aotz--   64.00g data                   4.17  

减小lvm大小

  1. 原始数据:
    file

  2. 配置命令:
    lvreduce -L -2G /dev/pve/base-1000-disk-0

    root@home:~# lvreduce -L -2G /dev/pve/base-1000-disk-0
    WARNING: Reducing active logical volume to 21.50 GiB.
    THIS MAY DESTROY YOUR DATA (filesystem etc.)
    Do you really want to reduce pve/base-1000-disk-0? [y/n]: y
    Size of logical volume pve/base-1000-disk-0 changed from 23.50 GiB (6016 extents) to 21.50 GiB (5504 extents).
    Logical volume pve/base-1000-disk-0 successfully resized.
  3. 修改后需要在虚拟机中将磁盘分离
    file

  4. 然后再添加
    file

  5. 最后可以看到,磁盘变小了
    file

发表回复

登录... 后才能评论