Prerequisites
Before extending a partition, make sure you have:
- SSH access to your VPS
- Root or sudo privileges
- Additional disk space allocated (via Hostxpeed upgrade)
- Backup of important data
⚠️ Disk operations can cause data loss if done incorrectly. Proceed with caution.
Step 1: Check Current Disk Size
Connect to your VPS:
ssh hxroot@YOUR_SERVER_IP -p 22
df -h
lsblk
Step 2: Verify Additional Space is Available
sudo fdisk -l
Look for the root disk (usually /dev/vda or /dev/sda).
Step 3: Resize Partition (ext4 filesystem)
For VirtIO disks (/dev/vda):
First, tell the kernel to rescan the disk:
echo 1 > /sys/block/vda/device/rescan
Resize the partition using growpart (install if needed):
apt install cloud-guest-utils -y
sudo growpart /dev/vda 1
Then resize the filesystem:
sudo resize2fs /dev/vda1
Step 4: For SCSI/SATA disks (/dev/sda)
sudo growpart /dev/sda 1
sudo resize2fs /dev/sda1
Step 5: For XFS filesystem (CentOS/RHEL)
sudo xfs_growfs /
Step 6: Verify Success
df -h
The root partition should now show increased size.
Alternative: Using fdisk (Manual Method)
If growpart is unavailable:
sudo fdisk /dev/vda
Inside fdisk:
- Print partitions: p
- Delete partition 1: d, then 1
- Create new partition: n, p, 1, accept defaults
- Write changes: w
Then reboot and resize filesystem:
sudo reboot
sudo resize2fs /dev/vda1
For LVM-based Systems
Extend physical volume:
sudo pvresize /dev/vda1
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
Check Filesystem Before Resizing
sudo e2fsck -f /dev/vda1
✅ Disk partition extended successfully. Your VPS now has access to the additional storage.