0

I cannot expand the disk of a server with an ubuntu 20 operating system on xen virtualization.

I have already updated the 250gb disk space to 265gb, but whatever I do on the command screen, the free space does not appear at all.

how can i expand without deleting my data or formatting the disk.

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 Answer 1

0

I guess I figured it out a little too fast. The problem was fixed by executing the following commands. Hope it will be helpful for those who have the same problem.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .