How to extend root Filesystem using LVM in CentOS 7 / RHEL 7

Filesystem / is 100% full

In this example we have the root Filesystem 100% full, it’s possible to expand the capacity a bit :

1. Add virtual disk to VM :

Follow the official documentation : https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-F4917C61-3D24-4DB9-B347-B5722A84368C.html

2. Show disks :

# lvmdiskscan

or

# fdisk -l

The new disk is /dev/sdb

3. Create primary partition

# fdisk /dev/sdb
n
p
1

ENTER
ENTER
t
8e
w

4. Show Filesystems types :

# df -T

In the example the Filesystems are xfs.

5. Format partition :

# mkfs.xfs /dev/sdb1

6. Create physical volume :

# pvcreate /dev/sdb1

7. Extend volume group “cl” :

# vgextend cl /dev/sdb1

8. Extend logical volume “root” :

# lvextend -l +100%FREE /dev/cl/root

Volume Group : cl
Logical Volume : root

9. Extend root Filesystem :

# xfs_growfs /dev/cl/root

Note: For ext4 Filesystems use: # resize2fs /dev/cl/root

Compartir:

This article was written by RoberMB

💻OS, ☁️Cloud, 🛡️Cybersecurity, ✈️Traveling #Linux, #Ansible, #AWS, #VMware, #Docker 🏴‍☠️ CEH v10, CPHE 🏴‍☠️ ... Always learning, always enjoying.

Leave a Reply

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