All Linux HowTo's

Extend XFS filesystem on CentOS 7 and RHEL 7

This article shows how to expand a filesystem on a CentOS 7 or Redhat Enterprise Linux 7 system by adding a second disk/filesystem.

The disk in this example is “/dev/sda” and it has two filesystems on it “/dev/sda1” and “/dev/sda2”. There is plenty of unused disk space available no “/dev/sda”. We’ll be extending the “/root” filesystem.

Add a partition using all available (previously unused) disk space. Make sure to create your partition as type “8e”.

fdisk /dev/sda

Run “partprobe” to make sure the kernel knows about the new partition.

partprobe

Get the Volume Group name which has “/root”:

vgdisplay

Add the new partition/disk to this Volume Group:

vgextend centos /dev/sda3

RUn PV Scan:

pvscan

You’ll see something like the following where the new partition/filesystem is available in the right Volume Group:

  PV /dev/sda2   VG centos   lvm2 [9.51 GiB / 40.00 MiB free]
  PV /dev/sda3   VG centos   lvm2 [90.00 GiB / 90.00 GiB free]

Extend the filesystem over the new partition/filesystem:

lvextend /dev/centos/root /dev/sda3
xfs_growfs -d /dev/centos/root 

Check your work:

df -h

Similar Posts:

Leave a Reply

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