• okass 在版块 Linux平台 中回复了话题 ubuntu的ubuntu–vg-ubuntu–lv空间扩容 2年, 11个月前

    ProxmoxVE(PVE) 减小缩减虚拟机硬盘设置的空间大小

     

    Proxmox VE WEB UI上调整虚拟机磁盘大小只能增加,不能减小
    如果想减小空间设置,需要通过命令行调整
    即是调整LV逻辑卷的大小,命令操作如下

     

    1> 先通过 lvs 命令查看虚拟机所设置的空间大小

    展示如下:

    root@pve:~# lvs
    LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
    data pve twi-aotz– <10.77t 0.72 0.63
    root pve -wi-ao—- 96.00g
    snap_vm-100-disk-0_Init pve Vri-a-tz-k 100.00g data vm-100-disk-0 4.82
    snap_vm-101-disk-0_Init pve Vri—tz-k 500.00g data vm-101-disk-0
    snap_vm-102-disk-0_Docker pve Vri-a-tz-k 500.00g data vm-102-disk-0 1.99
    snap_vm-102-disk-0_Init pve Vri-a-tz-k 500.00g data vm-102-disk-0 1.89
    snap_vm-102-disk-0_set_timezone pve Vri—tz-k 500.00g data vm-102-disk-0
    snap_vm-103-disk-0_Init pve Vri—tz-k 500.00g data
    snap_vm-103-disk-0_MariaDB pve Vri—tz-k 500.00g data vm-103-disk-0

     

    2>查看硬盘路径

    root@pve:~# lvdisplay

    — Logical volume —
    LV Path /dev/pve/vm-105-disk-0
    LV Name vm-105-disk-0
    VG Name pve
    LV UUID NC8FS6-aT32-vKvd-Die0-LgDr-FHgS-16UVXd
    LV Write Access read/write
    LV Creation host, time pve, 2021-09-24 12:03:00 +0800
    LV Pool name data
    LV Status available
    # open 1
    LV Size 924.00 GiB
    Mapped size 0.87%
    Current LE 236544
    Segments 1
    Allocation inherit
    Read ahead sectors auto
    – currently set to 256
    Block device 253:24

    — Logical volume —
    LV Path /dev/pve/snap_vm-105-disk-0_Init
    LV Name snap_vm-105-disk-0_Init
    VG Name pve
    LV UUID v5cCKU-Alrq-WnwA-L8dL-jaQp-7D5T-tUz4AA
    LV Write Access read only
    LV Creation host, time pve, 2021-09-24 12:07:48 +0800
    LV Pool name data
    LV Thin origin name vm-105-disk-0
    LV Status NOT available
    LV Size 1.00 TiB
    Current LE 262144
    Segments 1
    Allocation inherit
    Read ahead sectors auto

     

    3> 缩减磁盘容量,执行下边的命令将空间大小减小100G

    root@pve:~# lvreduce -L -100G /dev/pve/vm-105-disk-0

    WARNING: Reducing active and open logical volume to 824.00 GiB.
    THIS MAY DESTROY YOUR DATA (filesystem etc.)
    Do you really want to reduce pve/vm-105-disk-0? [y/n]: y
    Size of logical volume pve/vm-105-disk-0 changed from 924.00 GiB (236544 extents) to 824.00 GiB (210944 extents).
    Logical volume pve/vm-105-disk-0 successfully resized.

     

WirelessLink
Logo