DEV Community

Luger Lex Pit-og
Luger Lex Pit-og

Posted on

[Quick Notes] Growing My Ubuntu VM's Boot Disk

Made the VM disk bigger and had to tell the OS to actually use the extra space. Took 3 steps.

1. Grow the disk (hypervisor side)

Resized the virtual disk in Proxmox/VirtualBox, adding extra space (e.g. +20G). OS doesn't see it yet.

2. Grow the partition

sudo apt install cloud-guest-utils
sudo growpart /dev/vda 3
Enter fullscreen mode Exit fullscreen mode
  • growpart stretches a partition to fill new space.
  • The 3 is the partition number (from lsblk), not part of the disk name.
  • Ignored an unrelated shim-signed error during install — didn't affect anything.

3. Grow the filesystem

Checked for LVM first:

sudo pvresize /dev/vda3
Enter fullscreen mode Exit fullscreen mode

Got "command not found" → no LVM here, skip it.

Then resized the filesystem directly:

sudo resize2fs /dev/vda3
Enter fullscreen mode Exit fullscreen mode

(Use xfs_growfs / instead if filesystem is XFS, not ext4.)

4. Confirm

df -h /
Enter fullscreen mode Exit fullscreen mode

Showed full new size. And we're done! No reboot needed.

Cheat sheet

Check disk/partitions lsblk
Check filesystem usage df -h /
Grow partition sudo growpart /dev/vda 3
Grow filesystem (ext4) sudo resize2fs /dev/vda3
Grow filesystem (XFS) sudo xfs_growfs /

Remember

  • Back up/snapshot before resizing.
  • "Command not found" on LVM tools = you're not using LVM, that's fine.
  • Whole thing can be done live, no reboot.

Top comments (0)