Support > About independent server > Sharing common pitfalls in CentOS VPS disk partitioning and smooth expansion practices
Sharing common pitfalls in CentOS VPS disk partitioning and smooth expansion practices
Time : 2025-12-10 16:58:22
Edit : Jtti

Whether configuring a foreign VPS for the first time or upgrading an existing server, disk partitioning issues are always a persistent problem, ranging from insufficient space to system crashes. Many users find that after successfully expanding their disks in the console, the available space in their system hasn't increased at all; others have encountered the insurmountable 2TB limit when dealing with large-capacity hard drives. Behind these problems is usually a gap in understanding the Linux disk management mechanism, especially the relationship between partition tables and file systems. This article will focus on these high-frequency pain points, providing clear troubleshooting approaches and directly reusable solutions.

A very typical scenario is that a user purchases or expands their VPS disk from their service provider, but after logging into the system and checking with the df -h command, they find that the mount point capacity remains unchanged. This is not because the expansion operation failed, but because the expansion process was only half completed. The expansion operation in the cloud platform console only increases the "physical" capacity of the underlying virtual disk; the partitions and file systems within the disk are unaware of this change and require the user to manually complete the expansion within the operating system. At this point, the first step should be to use the lsblk or fdisk -l command for comparative diagnosis. The lsblk command provides a direct comparison between the disk size and partition size. If the disk size has increased while the partition size remains unchanged, the problem has been identified.

For the most common requirement of "appending expanded space to an existing partition," if your disk uses an MBR partition table and your kernel version is higher than 3.6.0, you can use the growpart tool online, which is a relatively safe and quick solution. The core operation process is as follows: first, install the necessary tools; then, extend the partition; and finally, extend the file system.

yum install cloud-utils-growpart -y
growpart /dev/vda 1

In the above command, /dev/vda is the disk device name, and 1 is the partition number. After successfully extending the partition, you must use different commands to extend the file system depending on the file system type. For EXT4 file systems, the command is resize2fs; for XFS file systems, you should use xfs_growfs. It's important to note that the XFS file system only supports expansion, not shrinking.

resize2fs /dev/vda1#

Or

xfs_growfs /mount/point

Another headache for users is the constraint of partition tables. Traditional MBR partition tables only support disks up to 2TB in size and a maximum of four primary partitions. When you mount a 3TB data disk to your VPS, if you continue to use the fdisk tool to create MBR partitions, the portion exceeding 2TB will be unusable. In this case, you must use the more modern GPT partition table. The parted tool is a powerful tool for managing GPT disks. The basic steps for initializing a new disk larger than 2TB are as follows:

parted /dev/vdb
mklabel gpt
mkpart primary 0% 100%
quit
mkfs -t ext4 /dev/vdb1

The above command sequence creates a GPT partition table for the /dev/vdb disk, allocates a single primary partition occupying the entire space, and finally formats it as an EXT4 file system. For system disks or environments requiring long-term stable operation, Logical Volume Management (LVM) offers unparalleled flexibility. Through an abstraction layer of "Physical Volume → Volume Group → Logical Volume," it allows administrators to dynamically adjust the size of logical volumes without needing to concern themselves with the underlying physical disk layout. In VPS environments where LVM is configured by default, expanding logical volumes is usually very simple.

When faced with "Disk space full" alerts, in addition to expanding, it's essential to master routine troubleshooting and maintenance commands. df -h is used to view disk usage at the file system level, while du -sh * can help pinpoint the space usage of specific directories. Regularly checking the /var/log log directory and the /tmp temporary directory is a good habit to prevent the root partition from accidentally filling up.

All disk operations carry risks. Before performing any partition adjustments, expansions, or formatting, the first and most important golden rule is: back up important data. For production servers, even creating snapshots should be done first. After performing operations that may involve changes to the partition table, the system may sometimes fail to immediately recognize the new layout. In such cases, try using the partprobe command to instruct the kernel to reread the partition table. Disk management on CentOS VPS is a technology that combines careful planning with bold execution. Understanding the logical layers of partition tables, file systems, and LVM, and mastering key tools like lsblk, growpart, resize2fs, and parted, transforms daunting disk issues into a standardized, step-by-step process. From identifying problems to successfully expanding capacity, every precise control over disk space contributes significantly to system stability and data security.

Relevant contents

Methods for precise performance matching of Japanese server CPUs under a multi-architecture approach The price war for US server CPUs has intensified, with even "bargain-priced" chips enabling the creation of high-performance servers. Linux Server Storage Performance Optimization: RAID and SSD Configuration Analysis What are the reasons why high-spec, low-cost servers from the United States have become the preferred choice for global users? Detailed Explanation of Japanese Server Process Kernel and Process Structure Memory What are the differences between CN2, BGP, and international lines in Hong Kong data centers? Which one offers the fastest access speed? In-depth analysis of Hong Kong HKT lines: How to determine if they can accelerate your business? What are the key metrics to evaluate when renting virtual hosting in Singapore? What types of businesses are suitable for Singapore servers? The decision-making process for renting a Singapore server. What are the advantages of renting an NTT server in Hong Kong? What types of business deployments is it suitable for?
Go back

24/7/365 support.We work when you work

Support