Expanding LVM Partition in RHEL7

Scenario:  I've created a VM with a RHEL7 guest.  The partition layout is a standard, primary partition for /boot and LVM for the rest--namely, /usr, /var, /home, swap and / (rootfs).  After installing updates and some other packages, the /usr directory began to fill up.

In order to mitigate the situation, I created an additional primary partition with an XFS filesystem, as that is the preferred/default FS in RHEL7.

    # parted /dev/vda mkpart P3 xfs 14G 16G

The above command instructs "parted" to operate on the /dev/vda disk and create primary partition 3 with XFS filesystem starting at 14G and ending at 16G.  
Next, I added the physical partition to LVM with the following command: 

    # pvcreate /dev/vda 

Then, extend the volume group with the physical partition with: 

    # vgextend rhel /dev/vda3 


    # lvextend -L+2G /dev/rhel/usr

Finally, to grow the filesystem I executed 

    # xfs_growfs /dev/rhel/usr    

NOTE: For an ext4 filesystem, use the resize2fs utility to grow the filesystem on-line.

       # resize2fs /dev/rhel/usr

Popular posts from this blog

Centos 7 pulseaudio

Password Policy in RHEL 7

RHEL 7 and CentOS 7 syslog Rate Limit