Linux Expand FileSystem With LVM

less than 1 minute read

Description:

Similar to Adding a second disk, this post will be to expand a specific partition on a linux OS (RHEL 7) with LVM.

  1. Attach a new disk (100GB) in vCenter

  2. Get the device name in RHEL:

    1
    2
    3
    4
    5
    6
    7
    
    cd /sys/class/scsi_disk
    ls
    # match the isci device in vCenter to the new device here and then type:
    echo "1" > 0:0:2:0/device/rescan
    # now 
    fdisk -l
    # for me, this is /dev/sdc
    
  3. Get the name of of the virtual group you want to extend by typing vgdisplay and copying its name (/dev/MyVG/u02). Then to add the new disk:

    1
    2
    3
    4
    5
    6
    7
    8
    
    # create physical partition
    pvcreate /dev/sdc
    # extend virtual group to include new disk
    vgextend MyVG /dev/sdc
    # add it to the LVM volume group. Subtract 10% for overhead 
    lvextend -L +90G /dev/MyVG/u02
    # Extend volume 
    xfs_growfs /dev/MyVG/u02
    

-----------------------------------------------------------
Spotted a mistake in this article? Why not suggest an edit!
Did you like the article? Donations are always welcome!
-----------------------------------------------------------

Comments