Linux Disk LVM Resize

Notes on Linux disk LVM

 

fdisk -l
 lvextend -L200G /dev/mapper/vg_share1-lv_home
 lvextend -L+200G /dev/mapper/vg_share1-lv_home
 lvextend -L+100G /dev/mapper/vg_share1-lv_home
 lvcreate -L+200G /dev/mapper/vg_share1-lv_home
 lvcreate -L 1500 -ntestlv testvg /dev/sdg1
 lvcreate -L 1500 -ntestlv /dev/mapper/vg_share1-lv_home /dev/sda1
 lvextend -L+200G /dev/mapper/vg_share1-lv_home
 vgdisplay
 vgs -o +vg_free_count,vg_extent_count
 pvs
 pvs
 lvs
 lv
 pvdisplay
 pvresize

pvresize /dev/sda1
 pvresize /dev/sda2
 df -h

resize2fs /dev/mapper/vg_share1-lv_home
 df -h
 resize2fs /dev/mapper/vg_share1-lv_home

 

 

 

 

 

 

 

 

 

 

RESIZE LVM PARTITION

first off resize the disk on VMware
now you should see unallocated space when viewing in gparted or something similar

Now you need to create an ext4 partition on this unallocated space, if the you cannot do this on the live system
then reboot and use gparted live and do so

now the space is partitioned

run

# pvcreate /dev/sda3
Run this command to extend the physical volume:

# vgextend vg_centosjw /dev/sda3
Run this command to verify how many physical extents are available to the Volume Group:

# vgdisplay vg_centosjw | grep “Free”
Run the following command to extend the Logical Volume:

# lvextend -L+4.8G /dev/vg_centosjw/lv_root

Where # is the number of Free space in GB available as per the previous command
then run

resize2fs /dev/vg_centosjw/lv_root

df -h /

 

[root@networkmon ~]# lvextend -L+4.8G /dev/vg_centosjw/lv_root
Rounding up size to full physical extent 4.80 GiB
Extending logical volume lv_root to 17.34 GiB
Logical volume lv_root successfully resized
[root@networkmon ~]# resize2fs /dev/vg_centosjw/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_centosjw/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_centosjw/lv_root to 4545536 (4k) blocks.
The filesystem on /dev/vg_centosjw/lv_root is now 4545536 blocks long.

[root@networkmon ~]#

Leave a Reply

Your email address will not be published. Required fields are marked *