How to Extend Filesystem on Linux After VPS Storage Upgrade


Did You Upgrade Your VPS Storage but Can’t See It?How to Extend Filesystem on Linux After VPS Storage Upgrade

One of the most common scenarios for VPS administrators is upgrading their disk space plan. You contact your hosting provider (like WPressly), they increase your disk limit, but when you log in to your server and type df -h, you still see the old size.

Don’t worry, this is normal behavior. The physical drive (or virtual disk) has been expanded, but your Linux Filesystem hasn’t been told to use that new space yet. In this guide, we will show you how to extend your partition safely without downtime.

Need Scalable Cloud Storage?
Our VPS plans allow you to scale your resources instantly as your business grows.
View Scalable VPS Plans

Step 1: Check Current Disk State

First, verify that the system detects the new physical space. Run the lsblk command:

lsblk

You might see that the main disk (e.g., /dev/vda) is larger than the partition inside it (e.g., /dev/vda1). This confirms the space is available.

Step 2: Extend the Partition (LVM or Standard)

Depending on your Linux setup (LVM or Standard Partition), the commands may vary. Here is the most common method using LVM (Logical Volume Manager), which is standard on many CentOS and Ubuntu systems.

Extend the Logical Volume to use 100% of the free space:

lvextend -l +100%FREE /dev/mapper/centos-root

Note: Replace /dev/mapper/centos-root with your actual filesystem path found in step 1.

Step 3: Resize the Filesystem

Now that the partition is bigger, you need to resize the file system itself. This depends on whether you are using EXT4 or XFS.

For EXT4 (Common on Ubuntu/Debian):

resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

For XFS (Common on CentOS/RHEL/AlmaLinux):

xfs_growfs /

Step 4: Verify the Success

Run the disk usage command again to confirm the new size:

df -h

You should now see your full upgraded storage available for use.


Conclusion

Managing a Linux server requires knowing how to handle storage effectively. Always backup your data before manipulating partitions.

Looking for a hosting partner that supports your growth?