Operations 4 min read

How to Shrink /home and Expand Root Partition on a Linux Log Server

This guide explains how to shrink the /home partition, install missing fuser, resize the filesystem, and expand the root directory on a CentOS/RHEL 7 log server, including commands for unmounting, killing processes, resizing ext4 or xfs partitions, and re‑mounting the filesystem.

ITPUB
ITPUB
ITPUB
How to Shrink /home and Expand Root Partition on a Linux Log Server

1. Problem Description

The log server was originally set up with an unreasonable partition layout, leaving the /home partition oversized and the root partition lacking space.

2. Goal

Reduce the size of the /home partition, extend the root ( /) partition, and ensure the system boots correctly after the changes.

3. Unmounting /home

Attempting to unmount /home fails with “target busy”. The usual way to find which process is using the mount point is with fuser -m /home or lsof, but the fuser command is missing.

# umount /home
umount: /home:目标忙。

4. Installing fuser

On CentOS/RHEL 7 the fuser utility is provided by the psmisc package.

# yum install psmisc

5. Identifying and Killing the Process

After installing fuser, run it to locate the offending process and terminate it.

# fuser -m /home   // continue to find who uses /home
# kill -9 11757    // stop the process
# umount /home    // unmount /home filesystem

6. Shrinking the /home Partition

Resize the logical volume to the desired size (e.g., 100 GB) using resize2fs for ext4 filesystems.

# resize2fs -p /dev/mapper/centos-home 100G

7. Verifying Filesystem Type

Check /etc/fstab to confirm the filesystem type of centos-home. If it is XFS, additional tools are required for expansion.

# cat /etc/fstab | grep centos-home

8. Installing XFS Tools (if needed)

For XFS expansion, install the xfsdump utility.

# yum install xfsdump -y

9. Expanding the Root Partition

After reducing /home to 100 GB, the freed space can be allocated to the root logical volume, extending the / directory.

10. Remounting /home

Attempt to mount /home again. If the mount fails with a superblock error, the partition must be formatted again, so back up all data before shrinking.

# mount /home
mount: /dev/mapper/centos-home:不能读超级块

Therefore, before reducing the size of /home, ensure a complete backup of its contents.

11. Final Steps

Re‑mount the /home partition after the root expansion and verify that both partitions are functional.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxsysadminPartitionXFSresize2fsfuser
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.