ubuntu 20卷组磁盘空间扩展问题

ubuntu 20卷组磁盘空间扩展问题

ubuntu 20操作系统的服务器在xen虚拟化上无法扩容。

我已经将 250GB 磁盘空间更新为 265GB,但无论我在命令屏幕上做什么,可用空间根本不会出现。

如何在不删除数据或格式化磁盘的情况下进行扩展。

lvextend -l +100%FREE /dev/mapper/vg0-lv--0
New size (63999 extents) matches existing size (63999 extents).

resize2fs /dev/vg0/lv-0
The filesystem is already 65534976 (4k) blocks long.  Nothing to do!


fdisk
Disk /dev/xvdb: 265 GiB, 284541583360 bytes, 555745280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/vg0-lv--0: 249.102 GiB, 268431261696 bytes, 524279808 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

lsbk
xvdb                      202:16   0  265G  0 disk 
└─vg0-lv--0               253:0    0  250G  0 lvm  /disk1

vgs
VG        #PV #LV #SN Attr   VSize    VFree
vg0         1   1   0 wz--n- <250.00g    0 

lvs
LV        VG        Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
lv-0      vg0       -wi-ao---- <250.00g

pvs
PV         VG        Fmt  Attr PSize    PFree
/dev/xvdb  vg0       lvm2 a--  <250.00g    0 

vgdisplay
  --- Volume group ---
  VG Name               vg0
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  11
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <250.00 GiB
  PE Size               4.00 MiB
  Total PE              63999
  Alloc PE / Size       63999 / <250.00 GiB
  Free  PE / Size       0 / 0   
  VG UUID               bLV6ef-wdHj-MnX3-1FbS-fDme-nbYA-YJmfRX

lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg0/lv-0
  LV Name                lv-0
  VG Name                vg0
  LV UUID                A6xPOa-YxR9-XPcJ-8MnX-Y4vr-tfxs-QkgNfC
  LV Write Access        read/write
  LV Creation host, time ubuntu-server, 2021-02-17 13:47:36 +0300
  LV Status              available
  # open                 1
  LV Size                <250.00 GiB
  Current LE             63999
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

df -Th
/dev/mapper/vg0-lv--0             ext4      246G  166G   70G  71% /disk1

答案1

我想我想得太快了一点。通过执行以下命令解决了该问题。希望对遇到同样问题的人有所帮助。

pvresize /dev/xvdb
pvscan
lvextend -l +100%FREE /dev/mapper/vg0-lv--0
resize2fs /dev/mapper/vg0-lv--0

相关内容