RHEL resize a logical volume

I have a kubernetes cluster installed in RHEL 8 system, after couple of months usage, the kubernetes node keep evicting pods, logs showed that has disk pressure, and the logical volume of root has 85% usage of total capacity, so I decide to resize the logical volume to increase the threshold for kubernetes cluster.

Check root volume usage

# Show disk details
lsblk
# Example output
[root@rhel8 ~]# lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda             8:0    0   300G  0 disk 
├─sda1          8:1    0     1G  0 part /boot
└─sda2          8:2    0   299G  0 part 
  ├─rhel-root 253:0    0    70G  0 lvm  /
  ├─rhel-swap 253:1    0  19.7G  0 lvm  
  └─rhel-home 253:2    0 209.3G  0 lvm  /home
sdb             8:16   0   2.4T  0 disk 

# check root volume usage
df -h /
# Output
[root@rhel8 ~]# df -h /
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   70G   60G   11G  86% /

/dev/mapper/rhel-root is the logical volume that I want to resize since it’s over 85% usage, I have a unused disk with 2.4T capacity, that’ll be used for extension.

# Create physical volume
pvcreate /dev/sdb
# Output
[root@rhel8 ~]# pvcreate /dev/sdb
WARNING: ext4 signature detected on /dev/sdb at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/sdb.
  Physical volume "/dev/sdb" successfully created.
# Identify the Volume Group
vgs
# Output
[root@rhel8 ~]# vgs
  VG   #PV #LV #SN Attr   VSize    VFree
  rhel   1   3   0 wz--n- <299.00g    0 

# Extend the Volume Group
vgextend rhel /dev/sdb
# Output
[root@rhel8 ~]# vgextend rhel /dev/sdb
  Volume group "rhel" successfully extended
# Verify
vgs
[root@rhel8 ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree 
  rhel   2   3   0 wz--n- <2.73t <2.44t

Identify the Logical Volume

# Use lvs to identify logical volume that needs to be extended
lvs
[root@rhel8 ~]# lvs
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home rhel -wi-ao---- 209.30g                                                    
  root rhel -wi-ao----  70.00g                                                    
  swap rhel -wi-a-----  19.69g             

# Extend the Logical Volume (use 30% of total free space)
lvextend -l +30%FREE /dev/rhel/root
# Output
[root@rhel8 ~]# lvextend -l +30%FREE /dev/rhel/root
  Size of logical volume rhel/root changed from 70.00 GiB (17920 extents) to <818.20 GiB (209459 extents).
  Logical volume rhel/root successfully resized.

# Confirm file system change
lsblk -f
# Output
[root@rhel8 ~]# lsblk -f
NAME          FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                    
├─sda1        xfs               fdc3093e-4f93-4659-bfe5-4915d283c3ab   /boot
└─sda2        LVM2_member       B1SQos-GFM4-z27S-3tgI-LbAY-VlKE-ZFFqJP 
  ├─rhel-root xfs               e060b083-fc34-459e-98a5-ef6aa3fa0436   /
  ├─rhel-swap swap              0e0cc53d-7b6f-4499-b686-99e6bfb98cd2   
  └─rhel-home xfs               00ea44e1-023d-439c-9473-f7c4bfb4de62   /home
sdb           LVM2_member       v49Epo-05sc-OALd-Mb4R-OBPL-qRd2-gZae3A 
└─rhel-root   xfs               e060b083-fc34-459e-98a5-ef6aa3fa0436   /

Reference:

https://www.redhat.com/sysadmin/resize-lvm-simple

Scroll to Top