rocky linux 9 - how to extend partition

- you increased the virtual harddisk for example on esxi host

- the harddisk is /dev/sda for example

- use command: cfdisk /dev/sda
-- use resize to increase for example /dev/sda5
-- make sure to leave cfdisk using write

- use command "vgs" to check the volume group, example:
VG #PV #LV #SN Attr VSize VFree
rl 1 2 0 wz--n- 46.82g 0

- now run pvrsize /dev/sda5
pvresize /dev/sda5
Physical volume "/dev/sda5" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized

- now run "vgs" again > you should see the increased hdd:
vgs
VG #PV #LV #SN Attr VSize VFree
rl 1 2 0 wz--n- 146.82g 100.00g

- now increase the locical volume
lvextend -l +100%FREE /dev/mapper/rl-root
Size of logical volume rl/root changed from 41.98 GiB (10747 extents) to 141.98 GiB (36347 extents).
Logical volume rl/root successfully resized.

- last step: increase the filesystem
if filesystem is ext use: resize2fs /dev/mapper/rl-root
if xfs - here comes a sample:

xfs_growfs /dev/mapper/rl-root
meta-data=/dev/mapper/rl-root isize=512 agcount=4, agsize=2751232 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=1 inobtcount=1 nrext64=0
data = bsize=4096 blocks=11004928, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=16384, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 11004928 to 37219328


see also:
https://www.onesystems.ch/blog/lvm-festplatte-vergroessern-ohne-neue-partition/

computer2know :: thank you for your visit :: have a nice day :: © 2024