Skip to content
0850 554 5439 [email protected]

How can we help?

Search our guides and tutorials, or browse the categories below.

Expanding disk space after growing a disk (ext4, xfs, LVM)

Gyro Cloud Istanbul 200 views Step-by-step guide Last verified: Markdown
What you will learnHow to make the new space of a disk you grew in the panel usable inside the server, picking the right command for your file system (ext4 or xfs) and layout (partitioned, unpartitioned, LVM).
Time8 minutes

1. Why are there two stages?

Growing a disk is a two-stage job:

  1. Panel (or API/CLI): increases the size of the virtual disk. The server sees the new size immediately, but the partition and file system inside stay at the old size.
  2. Inside the server (this guide): you expand the partition, LVM if used, and the file system to the new size.

An HDD (large storage) additional disk is grown with exactly the same steps.

Good news: expansion is done while the server is running (online); you do not need to shut down or unmount. Shrinking is not possible; you can only grow.

Warning

You cannot grow a disk while the server has a snapshot. Delete the snapshots first, grow, then take a snapshot again if you wish. We also recommend backing up important data off the server before growing.

2. First, check the situation

After growing in the panel, look at your disk layout on the server:

bash
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT
df -hT

lsblk shows the disk's new size. The layout below it will be one of three kinds:

What you see Layout Section
sdb disk with a partition sdb1 (part) below Partitioned 3.1
sdb disk formatted/mounted itself, no partition below Unpartitioned 3.2
sdc with vg...-lv... (lvm) below LVM 3.3

If lsblk still shows the old size, have the server rescan the disk (replace X with the disk name, e.g. sdb):

bash
echo 1 > /sys/class/block/sdX/device/rescan
lsblk

3. Expanding the space

3.1 Partitioned disk (sdb1)

Grow the partition first, then the file system:

bash
growpart /dev/sdb 1          # grows partition 1 of disk sdb to the end of the disk
resize2fs /dev/sdb1          # if ext4
# if xfs, use instead: xfs_growfs /mnt/data     (give the mounted folder)
df -h /mnt/data

If growpart is missing, install cloud-guest-utils (Ubuntu/Debian: apt install cloud-guest-utils) or cloud-utils-growpart (AlmaLinux/Rocky: dnf install cloud-utils-growpart). If growpart says "NOCHANGE: partition ... cannot be grown", the partition already reaches the end of the disk; go straight to the file system command.

3.2 Unpartitioned disk (formatted directly)

With no partition only the file system command is needed:

bash
resize2fs /dev/sdb           # if ext4
xfs_growfs /mnt/data         # if xfs (mounted folder)
df -h /mnt/data

3.3 If you use LVM

Expand the physical volume first, then the logical volume (-r grows the file system too):

bash
pvresize /dev/sdc
lvextend -r -l +100%FREE /dev/vgdata/lvdata    # take the vg and lv names from your system
df -h /mnt/lvm

If you do not know the names run vgs and lvs. If the disk is partitioned (LVM sits on sdc1), first run growpart /dev/sdc 1, then pvresize /dev/sdc1.

4. Growing the root disk

When you upgrade your plan on Gyro Cloud Istanbul, the root disk grows too (disks only grow, never shrink). In most cases the server expands it automatically: when we tested Ubuntu 24.04 and AlmaLinux 9 servers, lsblk and df -h showed the new size right away and no manual command was needed. Still, check:

bash
df -h /

If / does not show the new size, expand it by hand. Find the root partition number with lsblk (e.g. sda1 on Ubuntu, sda4 on AlmaLinux):

bash
growpart /dev/sda 1          # for AlmaLinux/Rocky usually: growpart /dev/sda 4
resize2fs /dev/sda1          # ext4 (Ubuntu/Debian); use your own root partition number
xfs_growfs /                 # xfs (AlmaLinux/Rocky)
df -h /
Note

The file system type in df -hT / tells you which command applies: ext4 → resize2fs, xfs → xfs_growfs.

5. Common problems

I grew the disk but the space is the same. df -h shows the size of the file system, not the disk; lsblk shows the disk size. Compare the two: if lsblk shows the new size, the missing piece is the command in Section 3. If lsblk also shows the old size, run echo 1 > /sys/class/block/sdX/device/rescan, and if that does not help check in the panel that the grow task finished.

The panel says "delete snapshots" and does not grow. A disk cannot be grown while the server has a snapshot. Delete the snapshot, grow the disk, take a new snapshot if needed.

resize2fs: Bad magic number in super-block error. The file system is not ext4 (probably xfs). Check the type with df -hT and use xfs_growfs.

xfs_growfs: ... is not a mounted XFS filesystem error. Give xfs_growfs the mounted folder, not the device (e.g. xfs_growfs /mnt/data).

I want to shrink the disk. Additional and root disks cannot be shrunk. If you need a smaller space, add a new small disk (using a disk guide), move the data and delete the old one. Before deleting, run umount and remove the fstab line.

I reinstalled the operating system; my additional disk is gone. A reinstall deletes additional disks and resets the root disk. Back up important data beforehand.

Do I need to reboot after expanding? No. Expansion is done online.

6. Frequently asked questions

Can I lose data while expanding?

Expanding normally does not affect data, but as with any disk operation we recommend backing up important data first. Shrinking a file system (not possible here) is risky; growing is safe.

Are the commands the same for additional and root disks?

Yes; the only difference is the partition and file system names. Check your own layout from lsblk and df -hT.

When does the price change after growing?

A grown disk is charged at its new size from the next hour. See the additional disk guide for details.

Can I grow several disks at once?

Yes; grow each in the panel, then run the relevant commands for each on the server in turn.

Next step

Was this helpful?

Thanks for your feedback!

Still Need Help?

Our support team is here around the clock for anything you can't find above.