RED HAT: Extending Logical Volumes

  • Post author:
  • Post category:IT / RedHat

Had a situation whereby /opt was running out of space. /Tmp had ample of space. Therefore, I decided to reduct /tmp and extend /opt volume. Following are the steps that I took.

1. Comment out the following from /etc/fstab

/dev/mapper/vg-lv-tmp /tmp 

2. Reboot the server
Rebooting the server will allow tmp files to go to vg-lv_root (/tmp) the directory not the logical volume

3. Resize /tmp

Destroy tmp

lvremove /dev/vg/lv_tmp

Create lv_tmp with 20G

lvcreate -n lv_tmp -L 20G vg

Create xfs filesystem

mkfs.xfs /dev/vg/lv_tmp

Mount the filesystem

mount -a

4. Extend /opt volume by 50G
Check if any services are running. Stop there are any service running.

lsof /opt
lvextend -L +50G /dev/vg/lv_opt

4. Grow XFS

 xfs-growfs /opt