How to Change Your VPS Partition Layout After OS Installation
Resize, shrink, or reorganize the partitions on a running VPS without reinstalling the OS — covering parted, growpart, resize2fs, xfs_growfs, and LVM.
A fresh VPS image usually ships with a single root partition that fills the disk. That works until you need a separate /var for database I/O, or you upgrade the plan and want to claim the new space. This article walks through that change end-to-end, with rollback advice for every step.
Back up before you partition. Always.
Modifying the partition table on a live system is a high-stakes operation. A power interruption or a typo can leave the filesystem unmountable. Take a snapshot or sync to off-site storage before running any command in this guide.
Before you start
- SSH or web console access to the VPS, plus a working rescue mode for safety.
- Root or
sudoprivileges. - A verified, fresh backup — not just a scheduled one.
- A 15-minute maintenance window with low traffic.
1Inspect your current layout
Before changing anything, photograph the current state. lsblk shows the block-device tree, df -h shows mounted filesystems, and parted -l reveals partition tables across every disk.
# See the block-device tree, sizes, and mount points lsblk -f # See used vs available space on every mounted filesystem df -hT # Show every disk's partition table in detail sudo parted -l
Save this output — you'll compare against it after the resize.
2Boot into a rescue session (when needed)
You can grow the root partition forward into adjacent free space on a running system. Anything more invasive — shrinking, moving, or repartitioning the root disk — requires booting from a rescue image so the disk isn't in use.
On VPS-SERVER HOST
Open your client area → My Services → select the VPS → Rescue Mode. Your VPS reboots into an ephemeral Linux image with your disk attached as /dev/vda. Temporary SSH credentials are shown in the panel.
ssh [email protected] lsblk # Check filesystem health before resizing (ext4 example) sudo e2fsck -f /dev/vda1
3Resize the partition with parted or growpart
Two practical tools: growpart for a quick extension into free space, or parted for full control. Both modify the partition table only — the filesystem is resized in step 4.
Option A — growpart (recommended for simple extensions):
# Install if missing sudo apt install cloud-guest-utils # Debian/Ubuntu sudo dnf install cloud-utils-growpart # AlmaLinux/Rocky # Grow partition 1 on disk /dev/vda into adjacent free space sudo growpart /dev/vda 1
Option B — parted (full control, including shrinking):
sudo parted /dev/vda (parted) print free (parted) resizepart 1 100% # Or to an explicit size: (parted) resizepart 1 80GB (parted) print (parted) quit
Shrinking is destructive in the wrong order
Always shrink the filesystem first (step 4), then shrink the partition. The opposite order will corrupt data.
4Resize the filesystem inside the partition
The partition is bigger, but the filesystem doesn't know yet. Grow it with the tool that matches your filesystem.
ext4:
# Grow ext4 to fill the resized partition sudo resize2fs /dev/vda1 # Or resize to an explicit size (useful when shrinking) sudo resize2fs /dev/vda1 40G
XFS (online, only grows):
# XFS expands by mount point, while online sudo xfs_growfs /
LVM (one command does partition + LV + FS):
# Tell LVM the physical volume is now larger sudo pvresize /dev/vda1 # Extend the logical volume to 100% of free space and resize the FS sudo lvextend -r -l +100%FREE /dev/mapper/vg0-root
5Verify and reboot
Confirm the new layout sticks, then boot back into the normal OS.
lsblk -f df -hT sudo parted -l # Exit rescue and reboot into the OS sync; reboot
Sanity-check after boot.
Run df -h once more and tail journalctl -b for filesystem warnings. No errors means you're done.
Frequently asked questions
Do I need to reinstall the OS to change my partition layout?
Will I lose data when I resize a partition?
What if my VPS is on LVM?
pvresize, then grow the logical volume and its filesystem in one command: lvextend -r -l +100%FREE /dev/mapper/vg0-root.Can VPS-SERVER HOST do this for me?
Need a VPS to practice on?
NVMe storage, rescue mode, and snapshots come with every plan.
Deploy a VPS Open a Ticket