October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Resize Ubuntu’s File System After Upgrading a VPS Disk

Upgrading a VPS disk does not automatically enlarge Ubuntu’s partition or filesystem. Follow the correct partition, LVM, and filesystem sequence for ext4 or XFS, then verify every layer safely.
Length10 min Posted Quest giverVGSources Team

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Increasing a VPS disk in your provider’s control panel changes the virtual disk capacity, not necessarily the partition, LVM volume, or filesystem inside Ubuntu. To use the new space, identify which layer still has the old size, enlarge the layers in order, and then grow the filesystem. For a direct ext4 partition that usually means growpart followed by resize2fs. With LVM, resize the partition, physical volume, logical volume, and finally the filesystem. XFS uses a different filesystem command.

Take a current backup before changing storage. Filesystem growth can perform repair work, and an interruption or incorrect target can cause data loss.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What changes when you upgrade a VPS disk

A VPS disk has several layers, and each layer keeps its own size. A typical direct layout is:

virtual disk → partition → filesystem → mount point

An LVM layout inserts three additional concepts:

virtual disk → partition → physical volume (PV) → volume group (VG) → logical volume (LV) → filesystem → mount point

Your provider can enlarge only the virtual disk. Ubuntu will continue reporting the old free space until every required layer is expanded. A filesystem utility cannot enlarge a partition, and a partition utility cannot enlarge a filesystem. Applying a command to the wrong device is one of the most common causes of failed or dangerous resizes.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Before you start: prerequisites and safety checks

Back up important data

Ubuntu recommends backing up data before filesystem resizing because the operation can include consistency checks and repair work. Ubuntu’s LVM guidance also recommends backups and notes that data loss remains possible even when LVM verifies whether an operation can be performed. Keep a backup that is independent of the VPS disk, and confirm that you know how to restore it.

Confirm that the provider-side upgrade is complete

Use the VPS provider’s control panel to increase the disk. Do not begin the guest-side procedure until the new virtual capacity is assigned. Some platforms expose the larger disk immediately; others require a reboot or a device rescan. If Ubuntu still sees the original disk size, stop at the detection stage and consult the provider’s procedure rather than modifying partitions.

Keep an administrative session available

Use a root shell or a user with sudo. If the resize is performed over SSH, keep a second session or out-of-band console available. A lost SSH connection does not necessarily mean the operation stopped, so check the result before repeating a command.

Inventory the storage layout

Run these commands before changing anything and save their output:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
df -Th
findmnt /

lsblk shows disks, partitions, and logical volumes; df -Th shows mounted filesystems, types, and their currently usable sizes; and findmnt / identifies the device and filesystem type used for the root mount.

If the output suggests LVM, collect its complete state as well:

sudo pvs
sudo vgs
sudo lvs -o lv_name,vg_name,lv_size,lv_path,devices

Look for the first layer whose size is smaller than the disk or layer above it. For example, if lsblk shows a 100 GB disk but a 40 GB partition, the partition is the next layer to grow. If the partition is 100 GB but the physical volume reports 40 GB, resize the PV. If the VG has free extents but the root LV is still 40 GB, extend the LV. If all block devices are large but df still shows 40 GB, grow the filesystem.

Choose the correct workflow

Layout or filesystem Required sequence Filesystem growth command
Direct partition with ext2, ext3, or ext4 Grow the partition, then the filesystem resize2fs /dev/device
LVM with ext2, ext3, or ext4 Grow partition, PV, LV, then filesystem resize2fs /dev/mapper/volume
LVM or direct partition with XFS Grow the block-device layers, then grow XFS xfs_growfs /mountpoint

The device names in these examples are illustrations. Substitute the paths confirmed by findmnt, lsblk, and the LVM commands. Do not infer a device name from another server or from a tutorial.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Workflow A: a direct partition with ext4

1. Confirm the disk and partition numbers

A common BIOS-style device might appear as /dev/vda with root on /dev/vda1; another system may use /dev/sda2. NVMe devices include the disk “p” separator, such as /dev/nvme0n1p3. In every case, identify the disk and the numbered partition from lsblk.

2. Install or locate growpart

On Ubuntu, growpart is commonly supplied by the cloud-guest-utils package. If the command is missing, install that package using your normal Ubuntu package-management process, provided the system has repository access. Check the command before proceeding:

command -v growpart
growpart --help

3. Extend the partition

The growpart utility extends a numbered partition to fill available space, ending at the disk end or immediately before the next partition. Its syntax is the disk device followed by the partition number, not the complete partition path:

sudo growpart /dev/vda 1

For an NVMe example:

sudo growpart /dev/nvme0n1 3

Read the proposed change carefully. If another partition follows the target, growpart can use only the contiguous free space before that next partition. Do not delete or recreate partitions simply to make a command fit; stop and take a partition-layout backup if the expected free space is not adjacent.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Make the ext4 filesystem use the new partition space

The resize2fs program expands ext2, ext3, and ext4 filesystems, but it does not change partition size. Run it against the enlarged partition, not the whole disk:

sudo resize2fs /dev/vda1

Replace the path with the partition that contains the root filesystem. ext4 growth is normally possible while mounted, but the command still needs the correct target and a healthy filesystem. If it reports filesystem errors, follow the repair guidance and do not force the operation blindly.

5. Verify each layer

lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
df -Th
findmnt /

The partition and filesystem should now show the intended capacity. df may show slightly less space than lsblk because filesystem metadata and reserved space are not available for ordinary files.

Workflow B: LVM with an ext4 root filesystem

LVM requires a separate operation for each layer. A common arrangement is a partition such as /dev/vda3 containing an LVM PV, a VG named ubuntu-vg, and a root LV represented by a path such as /dev/mapper/ubuntu--vg-ubuntu--lv. Use the names reported on your server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. Grow the partition that contains the PV

First confirm the PV’s backing device with pvs and lvs -o ... devices. Then extend that numbered partition:

sudo growpart /dev/vda 3

If the PV occupies the whole disk rather than a partition, there is no partition step; verify that fact before running any command.

2. Resize the physical volume

Tell LVM that the PV can use the enlarged partition:

sudo pvresize /dev/vda3

Check the result:

sudo pvs
sudo vgs

The VG should now show additional free space. If it does not, recheck that the partition really grew and that pvresize targeted the PV, not the LV.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Extend the logical volume

Identify the root LV path with findmnt / and lvs. To allocate all currently free extents in the VG:

sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

Using +100%FREE consumes all free space in that VG. If you need to retain space for another LV, use a specific size instead, such as an explicitly calculated extent or capacity, after checking the VG’s free space. LVM can expand a mounted volume when the filesystem on it supports online growth, as Ubuntu’s server documentation notes.

4. Grow the ext4 filesystem on the LV

Because the filesystem sits inside the LV, run resize2fs against the LV path:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

Some LVM versions offer lvextend -r to resize the filesystem as part of the LV extension. That convenience still depends on filesystem detection and support. The explicit sequence—extend the LV, identify the filesystem, then run its dedicated tool—makes the boundary between block-device and filesystem changes visible and is easier to troubleshoot.

5. Verify the LVM chain

sudo pvs
sudo vgs
sudo lvs -o lv_name,vg_name,lv_size,lv_path,devices
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
df -Th

The PV should include the enlarged partition, the VG should show the space you allocated, the LV should have its new size, and df should report the larger filesystem.

Workflow C: XFS and other filesystems

Identify the filesystem before choosing a command

The filesystem type appears in df -Th, findmnt -no SOURCE,FSTYPE /, and the FSTYPE column of lsblk. Do not run resize2fs on XFS; it is an ext-family utility.

Grow an XFS filesystem

After enlarging the direct partition or all required LVM layers, use the XFS utility with the mounted directory:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo xfs_growfs /

Replace / with the relevant mount point when growing another filesystem. XFS growth is designed for a mounted filesystem. Ensure the xfsprogs utilities are installed, and check the command’s output for errors before moving on.

Do not assume another filesystem behaves like ext4

Other filesystems have their own tools, support matrices, and online/offline rules. Verify the filesystem-specific procedure from the Ubuntu release documentation and the filesystem utility’s manual page. The block-device sequence—partition, PV, VG, and LV—still must be completed first when those layers exist.

Online versus offline resizing

Growing and shrinking are different operations. The procedures above are for growth after adding disk capacity. Never apply a grow procedure to make a filesystem smaller. Shrinking generally requires a filesystem-specific order and often an unmounted or offline filesystem; the partition must not be reduced before the filesystem has safely been reduced.

For growth, ext4 and XFS commonly support online expansion under the conditions documented for the filesystem and kernel. Ubuntu specifically states that LVM can expand a mounted partition when the filesystem supports it. “Mounted” does not mean “risk-free”: backups, correct device identification, and post-operation checks remain necessary. If a filesystem tool says it cannot operate online, schedule downtime, unmount the filesystem where required, and follow that filesystem’s offline sequence instead of forcing it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Using cloud-init to automate root expansion

Many cloud images use cloud-init to perform first-boot storage expansion. Its growpart module enlarges the root partition, while the resizefs module enlarges the filesystem afterward. The modules are intended to be paired: when growpart resizes the root partition, resizefs can resize the root filesystem as well.

Example cloud-init configuration

#cloud-config
growpart:
  mode: auto
  devices:
    - /
resize_rootfs: true

The root device is represented by / in the cloud-init example. Depending on the image and cloud-init version, resize_rootfs can be enabled, disabled, or set to a non-blocking mode. Non-blocking mode lets boot continue while resizing runs, which can change when the larger capacity becomes visible to services.

Check whether automation actually ran

Do not assume a larger provider disk was handled automatically. Inspect cloud-init’s state and logs:

cloud-init status --long
sudo journalctl -u cloud-init -b
sudo journalctl -u cloud-init-local -b

Confirm that the image includes the relevant modules, that they were enabled in the cloud-init configuration, and that the root layout is one the modules can expand. If logs show that growpart ran but resizefs did not, inspect the filesystem type and module configuration before performing a manual filesystem resize.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why the size still looks unchanged

The guest never detected the larger virtual disk

If lsblk reports the old disk capacity, the problem is below Ubuntu’s partition and filesystem layers. Check the provider operation, required reboot, and any documented device-rescan procedure. Do not run growpart until the disk itself shows the additional sectors.

The partition did not expand

If the disk is larger but the partition is not, verify that you supplied the disk and partition number in the correct growpart form. Check for a partition after the target; growpart stops before the next partition. A non-contiguous layout may require a planned partition move or backup-and-restore strategy rather than an in-place grow.

The PV or VG still has the old size

When pvs shows the old PV size, run pvresize on the confirmed PV device after the partition has grown. When vgs shows free space but the root LV remains small, extend the intended LV. If the VG has no free space, check that you resized the correct PV and that another LV did not consume the new extents.

The block device is larger but df is not

This means the filesystem has not been grown, or the filesystem tool was aimed at a different device. Use findmnt / to map the mount point to its source. Run resize2fs only for ext-family filesystems, or xfs_growfs for XFS, against the confirmed partition or LV.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The command reports errors or the system becomes unhealthy

Stop issuing additional resize commands. Capture the exact output, review kernel messages with dmesg or journalctl -k, and compare the current layout with your saved inventory. If filesystem checks are requested, use the filesystem’s documented repair process and a backup or snapshot before attempting recovery. Repeating a command against an uncertain target can make the situation worse.

A verification checklist

  • The provider’s virtual disk upgrade is complete.
  • lsblk shows the larger disk and the intended partition size.
  • The filesystem source from findmnt / matches the device you changed.
  • For LVM, pvs, vgs, and lvs show the expected PV, VG, and LV capacities.
  • The filesystem-specific growth command completed without an error.
  • df -Th reports the larger mounted filesystem.
  • Applications can create files in the newly available space, and monitoring reflects the new capacity.

Key distinctions to remember

  • growpart changes a partition boundary. It does not resize the filesystem inside that partition.
  • pvresize changes LVM’s view of a physical volume. It does not enlarge a logical volume or filesystem.
  • lvextend enlarges an LV. It does not always resize the filesystem unless you deliberately use a supported filesystem-resize option.
  • resize2fs grows ext2, ext3, and ext4. It does not manipulate partition size and is not an XFS tool.
  • xfs_growfs grows XFS. Use the mounted directory and confirm all underlying block-device layers are already larger.
  • Cloud-init is configuration-dependent. Its growpart and resizefs modules work only when enabled and supported by the image.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.