Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › cloud-init

How to Resize the File System in Ubuntu After Upgrading a VPS

By Freedom251 Team · · 10 min read

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

Upgrading a VPS disk usually changes the size of the virtual disk, not the partition and filesystem inside Ubuntu. The fix is to expand each storage layer in order: confirm the new disk size, grow the partition, enlarge any LVM physical volume and logical volume, then grow the filesystem. For a typical direct ext4 root partition, the sequence is growpart followed by resize2fs. LVM adds pvresize and lvextend; XFS requires xfs_growfs instead of resize2fs.

Do not run a filesystem command until you have identified whether its target is a partition or an LV and confirmed the filesystem type. Record the layout first, keep a usable backup, and verify every layer after the change.

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.

Why Ubuntu still reports the old capacity

A VPS provider can enlarge the virtual block device while leaving Ubuntu’s existing partition table unchanged. The guest may therefore see a larger disk in lsblk, while df -Th continues to show the old filesystem size. The unused space exists after the last partition, but no filesystem can use it until the intervening layers are expanded.

Storage is layered. A simple installation commonly looks like:

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
virtual disk (for example, /dev/vda)
└── partition (for example, /dev/vda1)
    └── filesystem (ext4, XFS, or another type)

An LVM installation inserts three more concepts:

virtual disk
└── partition
    └── physical volume (PV)
        └── volume group (VG)
            └── logical volume (LV)
                └── filesystem

Each layer has a different tool. growpart changes a partition boundary; it does not resize a filesystem. pvresize updates LVM’s view of a physical volume. lvextend allocates free space in a volume group to an LV. resize2fs grows ext2, ext3, and ext4 filesystems, but does not alter partitions. XFS uses a filesystem-specific command.

Before you change anything

Back up data and plan a recovery path

Ubuntu advises backing up important data before resizing. Resize operations can include filesystem checks or repair work; an interruption, power failure, or wrong device name can damage data. LVM performs checks before many operations, but those checks do not eliminate the possibility of data loss.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Confirm that a current backup can actually be restored, rather than merely existing as a file.
  • Keep the VPS provider’s rescue or console access available in case the guest fails to boot.
  • Schedule the change if your provider or filesystem requires downtime.
  • Do not use a grow procedure to shrink a filesystem. Shrinking requires a filesystem-specific order, normally starting with the filesystem while it is offline and only then reducing the containing LV, partition, and disk.

Use a root shell and install the required utility

Run commands as root or prefix them with sudo. On Ubuntu, growpart is supplied by the cloud-guest-utils package on many images. If the command is missing, install that package through your normal package repository before proceeding:

sudo apt update
sudo apt install cloud-guest-utils

Do not install packages or reboot until you have recorded the current layout. A reboot is not normally needed for a partition and filesystem growth operation, but a provider’s disk-rescan procedure may differ.

Inventory the disk, partitions, mounts, and filesystem

Start with a read-only inventory. Save the output in your change notes so you can compare it later.

lsblk
sudo df -Th
findmnt /

lsblk shows disks, partitions, and (when applicable) device-mapper paths. df -Th identifies the filesystem type and its currently usable size. findmnt / tells you exactly which device backs the root mount.

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.

If the root device is an LVM logical volume, collect the LVM state as well:

sudo pvs
sudo vgs
sudo lvs

Look for the provider’s new capacity in lsblk. If the disk itself is still the old size, Ubuntu has not yet detected the virtual-disk upgrade; use the VPS control panel’s rescan or reboot procedure, then repeat the inventory. If the disk is larger but the final partition is unchanged, continue with partition growth.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Map the device path before selecting a command

Write down the complete path for the root mount. Typical direct layouts use a path such as /dev/vda1. LVM layouts may show a mapper path such as /dev/mapper/ubuntu--vg-ubuntu--lv. The name is installation-specific; never copy an example blindly.

  • Direct partition: the root filesystem is mounted directly from a numbered partition.
  • LVM: the root filesystem is mounted from an LV, and the partition containing the PV must be expanded first.
  • Multiple partitions: growpart can only consume free space immediately after the selected partition and before the next partition.

Choose the correct expansion path

Layout or requirement Intermediate steps Filesystem step Typical online behavior
Direct partition with ext2/ext3/ext4 Grow the numbered partition with growpart resize2fs on that partition ext4 growth is commonly online when the kernel and filesystem support it
Direct partition with XFS Grow the numbered partition with growpart xfs_growfs on the mounted filesystem XFS growth is performed from the mounted filesystem; verify your distribution and mount state
LVM PV containing ext2/ext3/ext4 growpart, then pvresize, then lvextend resize2fs on the LV, or a supported combined LV/filesystem operation Ubuntu documents that LVM can expand a mounted volume when the filesystem supports online growth
LVM PV containing XFS growpart, then pvresize, then lvextend xfs_growfs on the mount point Growth is generally online, but confirm the filesystem and mount requirements first
Any filesystem being reduced Not a grow workflow Use that filesystem’s documented offline-shrink procedure Expect downtime and a separate backup/rollback plan

Direct partition: expand an ext4 root filesystem

Use this path when findmnt / points directly to a partition such as /dev/vda1, and df -Th reports ext2, ext3, or ext4. Replace every example device with the path from your inventory.

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

1. Extend the partition

The growpart syntax is the disk device followed by the partition number, separated into two arguments:

sudo growpart /dev/vda 1

The utility extends the numbered partition to fill available space, stopping at the end of the disk or before the next partition. A successful run reports the old and new partition boundaries. If it says there is no space to grow, inspect lsblk and the partition table: another partition may occupy the space, or the guest may still see the old virtual-disk size.

2. Expand the ext filesystem

After the partition is larger, expand the filesystem that lives on it:

sudo resize2fs /dev/vda1

resize2fs expands ext2, ext3, and ext4 filesystems. It does not manipulate partition size, so running it before growpart cannot claim space that the partition does not yet contain. For a mounted root ext4 filesystem, growth is normally performed online; if the command requests an offline check or reports an unsupported condition, use the provider console or rescue environment and follow the filesystem’s required maintenance procedure.

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

3. Verify both layers

lsblk
df -Th
findmnt /

The partition in lsblk and the filesystem size in df -Th should now reflect the intended capacity. A small difference between decimal disk units and binary filesystem units is normal; a filesystem that remains at its old size indicates that the filesystem step did not complete or targeted the wrong device.

Direct partition: expand XFS

XFS cannot be grown with resize2fs. First extend the partition exactly as in the ext4 procedure:

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
sudo growpart /dev/vda 1

Then identify the mount point with findmnt / or the relevant entry in df -Th, and grow the mounted XFS filesystem by mount point:

sudo xfs_growfs /

Use the actual mount point if the filesystem is not root. XFS growth has different prerequisites and diagnostics from ext4; verify that the filesystem is XFS and mounted before running the command. Recheck with lsblk and df -Th.

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

LVM: expand a root logical volume

Use this workflow when findmnt / points to an LV and pvs, vgs, or lvs confirms LVM. The usual order is partition, PV, VG allocation, LV, then filesystem.

1. Grow the partition that contains the PV

Find the PV device in pvs. It may be a whole disk or a partition such as /dev/vda3. If it is a partition, extend that partition:

sudo growpart /dev/vda 3

If the PV occupies the whole disk, there is no partition boundary to grow; skip growpart and proceed to pvresize after confirming that the virtual disk is larger.

2. Make LVM recognize the larger PV

sudo pvresize /dev/vda3

Substitute the PV path reported by pvs. Then inspect the volume group:

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

vgs should show additional free space. If it does not, stop and resolve the layer that remains small; extending an LV cannot work until the VG has free extents.

3. Allocate free VG space to the LV

Identify the LV mounted at the target path. To assign all currently free space in the volume group:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

The mapper name is only an example. Use the exact LV path from lvs or findmnt. If you want a specific size rather than all free extents, use an explicit size supported by your LVM version and leave the remaining VG space unallocated for later growth.

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

Some LVM versions support combining LV and filesystem growth with lvextend -r. Because that option invokes filesystem tooling automatically, use it only after confirming the filesystem type and target:

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

For maximum control, extend the LV without -r, verify its new size, and run the filesystem-specific command yourself.

4. Grow the filesystem on the LV

For ext2, ext3, or ext4:

sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

For XFS, use the mounted path instead:

sudo xfs_growfs /

Do not pass the PV or the partition to resize2fs when the filesystem is actually inside an LV. Conversely, do not pass an LV path to pvresize; PV operations apply to the physical volume.

5. Verify the complete LVM chain

sudo pvs
sudo vgs
sudo lvs
lsblk
df -Th
findmnt /

The disk and containing partition should show the expanded capacity, the PV should contain the new extents, the VG should show less free space if you allocated it, and the LV and filesystem should both report the intended size. If the VG still has free space, that is not an error; it means you intentionally or accidentally left capacity unallocated.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Automating root growth with cloud-init

Cloud images can automate the common root-disk case. cloud-init documents pairing its growpart and resizefs modules so that a root partition expanded by growpart is followed by filesystem growth. A representative configuration is:

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

The resize_rootfs setting can be enabled, disabled, or configured to run non-blocking according to the image’s cloud-init version and configuration. The exact module behavior depends on the image, installed packages, datasource, and whether the root layout is direct or LVM.

Check whether automation ran

Do not assume a cloud image resized itself. Inspect cloud-init status and logs, then repeat the inventory commands:

cloud-init status --long
sudo journalctl -u cloud-init
sudo journalctl -u cloud-final
lsblk
df -Th

Logs can reveal that growpart was skipped because no free space followed the partition, that the utility was not installed, or that filesystem growth was disabled. If automation is disabled or incomplete, finish the layers manually after confirming the current state.

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

Troubleshooting when the size does not change

The disk still has its old size

Ubuntu cannot expand space it cannot see. Recheck the VPS control panel, rescan procedure, and lsblk. If the provider has not presented the larger virtual disk to the guest, partition and filesystem commands will correctly report no available space.

growpart says there is no room

Confirm that you supplied the disk and partition number separately, for example growpart /dev/vda 1. Then inspect whether another partition follows the target. The utility grows only into contiguous free space and stops before the next partition.

The partition grew but df did not

This means the filesystem layer is still unchanged. For ext filesystems, run resize2fs against the enlarged partition or LV. For XFS, run xfs_growfs against its mounted path. First verify the filesystem type and mount source with df -Th and findmnt.

pvresize finds no additional space

Check that the PV’s containing partition was expanded and that you used the PV path shown by pvs. If the PV is a whole disk, confirm the disk itself grew. A VG cannot gain extents until the PV recognizes the larger underlying device.

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

lvextend reports insufficient free space

Run vgs and inspect the free extent count. Either the PV was not resized, another LV already consumed the space, or the requested LV size exceeds the VG’s free capacity. Do not force an allocation beyond available extents.

A resize command reports a check or repair condition

Stop and read the command’s diagnostic. An online operation may be unsupported for the filesystem, mount, kernel, or image configuration. Use console or rescue access, ensure a backup is available, and perform any required filesystem check or offline procedure before retrying.

Online versus offline growth

Ubuntu’s LVM guidance notes that LVM can expand a mounted volume when the filesystem used on it supports online growth. This is why a mounted ext4 or XFS root filesystem can often be expanded without booting from rescue media. “Often” is not universal: filesystem type, kernel support, image configuration, and the exact operation matter.

  • Online growth: useful for a running server when the filesystem supports it; keep a backup and monitor command output.
  • Offline growth: required when the filesystem or requested operation cannot be performed safely while mounted; plan a maintenance window and use the provider console or rescue image.
  • Shrinking: a separate, higher-risk workflow. Never reverse the grow commands or reduce an LV before reducing its filesystem.

A repeatable checklist

  1. Confirm the VPS provider completed the disk upgrade.
  2. Save output from lsblk, df -Th, and findmnt /.
  3. If LVM is present, save pvs, vgs, and lvs.
  4. Back up important data and confirm console or rescue access.
  5. Identify the layer that still has the old size.
  6. Run growpart on the correct numbered partition when free space follows it.
  7. Run pvresize if that partition is an LVM PV.
  8. Run lvextend if the filesystem is inside an LV.
  9. Use resize2fs for ext2/ext3/ext4 or xfs_growfs for XFS.
  10. Repeat all inventory commands and confirm disk, partition, PV, VG, LV, and filesystem sizes.

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.

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

cloud-initext4Filesystem resizeLinux StorageLVMUbuntuVPSXFS

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.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.