Expand Disk After Upgrade

After upgrading your plan from VirtFusion, the additional space is allocated to the virtual disk but is not yet usable until you extend the partition and filesystem.

Take a snapshot from the VirtFusion panel before proceeding. Operations on partitions and filesystems, if interrupted, can make the system unbootable.

02

Check available space

bash
# Total physical disk space
fdisk -l /dev/vda | head -5

# Space used per partition
df -h

# Current partitions
lsblk

Typical output:

vda 252G # total disk (new) └─vda1 100G # current partition (old size)
03

Identify the disk and partition

bash
lsblk -f
NAME FSTYPE SIZE MOUNTPOINT vda 252G └─vda1 ext4 100G /

Disk: /dev/vda, Partition: /dev/vda1, Filesystem: ext4

04

Extension with growpart + resize2fs

Install growpart

bash
apt install cloud-guest-utils -y   # Debian/Ubuntu
dnf install cloud-utils-growpart -y  # AlmaLinux/CentOS

Extend the partition

bash
# Extend vda1 to maximum available space
growpart /dev/vda 1

Expected output:

CHANGED: partition=1 start=2048 old: size=209715167 end=209717215 new: size=528480223 end=528482271

Extend the ext4 filesystem

bash
resize2fs /dev/vda1

Output:

resize2fs 1.46.5 (30-Dec-2021) Filesystem at /dev/vda1 is mounted on /; on-line resizing required old_desc_blocks = 13, new_desc_blocks = 32 The filesystem on /dev/vda1 is now 66060027 (4k) blocks long.

Verify

bash
df -h /

Now shows the updated size.

05

XFS Filesystem (AlmaLinux/CentOS)

For XFS filesystems, use xfs_growfs instead of resize2fs:

bash
# Extend the partition
growpart /dev/vda 1

# Extend the XFS filesystem (can be done while mounted)
xfs_growfs /
06

LVM (Logical Volume Manager)

If your VPS uses LVM (visible as dm-0 or vg0-lv0 in lsblk):

bash
# Check LVM layout
pvdisplay
vgdisplay
lvdisplay

# Extend the physical volume
pvresize /dev/vda2

# Extend the logical volume to 100% of free space
lvextend -l +100%FREE /dev/vg0/lv0

# Extend the filesystem
resize2fs /dev/vg0/lv0    # ext4
# or
xfs_growfs /               # xfs
07

Add a secondary disk

If you added a second disk from the panel (e.g. /dev/vdb):

bash
# Verify the disk is detected
lsblk | grep vdb

# Create filesystem
mkfs.ext4 /dev/vdb

# Create mount point
mkdir /mnt/data

# Manual mount
mount /dev/vdb /mnt/data

# Permanent mount (survives reboot)
echo '/dev/vdb /mnt/data ext4 defaults 0 2' >> /etc/fstab

Verify fstab:

bash
mount -a   # mount everything from fstab without rebooting
df -h /mnt/data
08

Troubleshooting

growpart: "NOCHANGE: partition 1 is size..."

The physical disk has not been expanded yet. Verify in the VirtFusion panel that the resize is complete before proceeding. Sometimes a VPS reboot is required.

resize2fs: "Bad magic number in super-block"

The disk is not ext4. Use lsblk -f to verify the type and use the correct tool (xfs_growfs for XFS, btrfs filesystem resize for Btrfs).

Partition cannot be expanded

If the partition is not the last on the disk, growpart cannot expand it. In this case you need to act from rescue mode with gparted.

DeluxHost, gegründet 2023, bietet hochwertige Hosting-Lösungen für verschiedene digitale Anforderungen. Wir bieten Shared Hosting, VPS und dedizierte Server mit erweiterter Sicherheit und globalen Rechenzentren.

© DeluxHost, Alle Rechte vorbehalten. | USt-IdNr.: IT17734661006
Alle Systeme betriebsbereit