Operations 4 min read

How to Shrink /home and Expand the Root Partition on CentOS 7

This guide explains how to safely reduce the /home partition size, free up space, and extend the root filesystem on a CentOS 7 server by unmounting /home, locating and terminating lingering processes, resizing the filesystem, installing required tools, and remounting the adjusted partitions.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Shrink /home and Expand the Root Partition on CentOS 7

Background

The original log server was set up with an improperly sized partition layout, leaving the /home filesystem consuming excessive space while the root partition ( /) lacked room for growth.

Goal

Reduce the /home partition to about 100 GB.

Expand the root filesystem to use the freed space.

Unmount /home safely, handling the "target busy" error.

Step 1 – Identify and Stop Processes Using /home

Attempting to unmount /home yields:

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

Use fuser (or lsof) to locate the processes. On a minimal CentOS 7 installation the fuser command may be missing, so install it first: # yum install psmisc -y After installation, run: # fuser -m /home Kill the listed processes (example PID 11757): # kill -9 11757 Now the filesystem can be unmounted:

# umount /home

Step 2 – Resize the /home Filesystem

Assuming /home is an ext4 logical volume, shrink it with: # resize2fs -p /dev/mapper/centos-home 100G Verify the filesystem type; if it is XFS, the approach differs (XFS cannot be shrunk directly). Check the /etc/fstab entry:

# cat /etc/fstab | grep centos-home

Step 3 – Prepare for XFS Expansion (if applicable)

If the partition uses XFS, install the xfsdump utility, which is required for certain XFS operations:

# yum install xfsdump -y

Step 4 – Re‑mount and Verify

After shrinking, attempt to mount /home again:

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

The error indicates the filesystem needs to be recreated; therefore, back up any data from /home before proceeding.

Once the backup is complete, format and mount the resized partition:

# mkfs.xfs /dev/mapper/centos-home
# mount /home

Result

The /home partition is now limited to 100 GB, freeing space for the root filesystem to be expanded. Remember to always back up critical data before resizing or reformatting partitions.

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.

LinuxPartitionCentOSResizeXFS
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

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.