Merging /home into the Root (/) Partition on LVM

Remove the dedicated /home logical volume and reallocate its disk space to the root (/) partition. System Environment: Oracle Linux / RHEL / CentOS (LVM-based).

⚠️ WARNING: DATA DELETION

This process will permanently delete everything currently stored in /home.

  • Backup: Copy important files to an external drive or cloud storage before starting.

  • User Access: After this process, you must manually recreate your user directory to allow logins.


Step 1: Terminate Processes & Unmount

The system will not allow you to remove /home if any files are being accessed (usually by your user session).

  1. Log in as root (or use sudo).

  2. Kill all processes using the /home partition:

    Bash

    fuser -km /home
    

    (Note: If you are logged in as a standard user, your session will end. Log back in immediately as root.)

  3. Unmount the volume:

    Bash

    umount /home
    

Step 2: Remove the Home Logical Volume

Now that the partition is unmounted, you can delete it to return the space to the Volume Group pool.

  1. Remove the LV:

    Bash

    lvremove /dev/ol/home
    

    Type y when asked to confirm.

Step 3: Extend the Root Logical Volume

Next, tell the root partition to grow and take up all the newly available space.

  1. Extend the LV:

    Bash

    lvextend -l +100%FREE /dev/ol/root
    

Step 4: Grow the Filesystem

The "container" is now larger, but the filesystem needs to be stretched to fill it. Based on your output, you are likely using XFS.

  1. Grow the XFS filesystem:

    Bash

    xfs_growfs /
    

    (If using ext4, use: resize2fs /dev/ol/root instead.)

Step 5: Update the Filesystem Table (fstab)

You must prevent the system from trying to mount the deleted volume at boot.

  1. Open the fstab file:

    Bash

    vi /etc/fstab
    
  2. Find the line for /home and delete it or comment it out by adding a # at the start:

    Plaintext

    #/dev/mapper/ol-home  /home  xfs  defaults  0 0
    
  3. Save and exit.

Step 6: Recreate User Home Directory

Since the physical partition is gone, /home is now just a folder on your root disk. You must recreate your user's space:

Bash

mkdir -p /home/$USER
chown $USER:$USER /home/$USER
chmod 700 /home/$USER

Verification: Run lsblk and df -h to confirm / now shows the increased size .

Updated on