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

おすすめ記事