How to Extend a VPS Disk: growpart and resize2fs 2026
After the disk is enlarged in the provider panel, the filesystem does not grow by itself — you extend the partition with growpart and then the filesystem itself: resize2fs for ext4 or xfs_growfs for XFS. The operation runs on a mounted disk without data loss. Here is the exact sequence.
How growing a disk works
Expansion happens in three layers:
- The provider enlarges the virtual disk (from 40 to 80 GB, for example).
- The partition (
/dev/vda1) is extended to the new disk size —growpart. - The filesystem is extended to the partition size —
resize2fs/xfs_growfs.
Important: take a backup or a snapshot before you start. The risk is small, but a disk holds your data.
Step 1. Checking the current state
df -h
lsblk
df -h shows used space on mounted filesystems, lsblk shows the real size of the disk and its partitions. If the disk (vda) is already 80 GB while the partition (vda1) is still 40 GB, it needs extending.
Determine the filesystem type:
findmnt -no FSTYPE /
It returns ext4, xfs or another type — that decides the command in step 3.
Step 2. Extending the partition with growpart
Install the utility if it is missing:
apt install -y cloud-guest-utils
Extend the partition. Note the space between the disk name and the partition number:
growpart /dev/vda 1
Here /dev/vda is the disk and 1 is the partition number. Check the result:
lsblk
The vda1 partition should now occupy the whole disk.
Step 3. Extending the filesystem
For ext4/ext3
resize2fs /dev/vda1
resize2fs can grow a mounted filesystem on the fly — no unmounting required.
For XFS
XFS is grown by mount point rather than by device:
xfs_growfs /
Step 4. Verification
df -h /
The root partition should now report the new size. The data is intact and no reboot is needed.
The LVM case
With LVM the order is different. First extend the physical volume, then the logical one:
pvresize /dev/vda1
lvextend -l +100%FREE /dev/mapper/vg-root
resize2fs /dev/mapper/vg-root
For XFS use xfs_growfs / instead of resize2fs.
Check the LVM layout:
pvs
vgs
lvs
If growpart is not available
On systems without cloud-guest-utils, the partition is extended with parted or fdisk (deleting and recreating the partition with the same start sector and a larger end). That is riskier — always take a snapshot first and follow the procedure for your specific layout.
Adding a separate disk
Sometimes the provider gives you a second disk (/dev/vdb) instead of a larger one. It is partitioned and mounted separately. Create a filesystem:
mkfs.ext4 /dev/vdb
Mount it, for data storage for example:
mkdir -p /mnt/data
mount /dev/vdb /mnt/data
To have the disk mounted automatically after a reboot, add an entry to /etc/fstab by UUID:
blkid /dev/vdb
UUID=<the-uuid-you-got> /mnt/data ext4 defaults 0 2
Verify fstab without rebooting:
mount -a
df -h /mnt/data
An error in fstab can prevent the system from booting, so mount -a is a mandatory check.
Growing swap when memory runs short
If you enlarged the disk for swap space, you can grow the swap file. Turn the current one off and create a bigger one:
swapoff /swapfile
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
Check it:
free -h
Quick reference
| Step | ext4 | XFS |
|---|---|---|
| Partition | growpart /dev/vda 1 |
growpart /dev/vda 1 |
| Filesystem | resize2fs /dev/vda1 |
xfs_growfs / |
| Check | df -h |
df -h |
Frequently asked questions
Do I need to unmount the disk? No. resize2fs and xfs_growfs work on a mounted root filesystem without downtime.
Will I lose data? Not with the correct commands. Still, always take a snapshot or a backup before touching partitions.
growpart says NOCHANGE — why?
The partition already fills the whole disk. Confirm that the provider really did enlarge the disk (lsblk).
Can I shrink a disk the same way? Shrinking is harder and riskier: ext4 requires unmounting and XFS does not support shrinking at all. Plan the size in advance.
Is a reboot required? Usually not. If the system does not see the new disk size, a reboot after the provider-side change helps.
Need a bigger disk? Scale on a VPS plan with NVMe, or take a VPS for security and VPN. Resizing and maintenance without downtime can be done by Server administration.