personal_infra/03_vm_disk_enlargement.md
2026-03-22 21:25:08 +01:00

2 KiB

03 VM Disk Enlargement

How to enlarge the disk of an existing Proxmox VM that was provisioned via the tofu project.

Overview

Since the tofu VM resource uses ignore_changes = all in its lifecycle block, disk resizes are performed manually through the Proxmox UI and then expanded inside the guest OS. You should still update the tofu vars to keep them in sync with reality.

Step 1: Update disk size in tofu vars

  • Edit tofu/nodito/terraform.tfvars and bump the disk_size_gb value for the VM you want to resize.
  • This won't trigger any actual change (because of ignore_changes = all), but keeps the declared state consistent so future readers know the real disk size.

Step 2: Resize the disk in Proxmox

  • Open the Proxmox web UI and navigate to the VM.
  • Go to the Hardware tab.
  • Select the Hard Disk entry (scsi0).
  • Click Disk Action > Resize.
  • Enter the amount of additional space you want to add (this is the increment, not the total). For example, to go from 10 GB to 30 GB, enter 20.
  • Click Resize disk.

The VM does not need to be stopped for this operation. Proxmox will grow the underlying block device while the VM is running.

Step 3: Expand the partition and filesystem inside the VM

SSH into the VM and run these steps as root (or with sudo).

Check the current layout

lsblk

You should see that the disk (sda) now shows the new total size, but the root partition (sda1) still has the old size.

Grow the partition

Install cloud-guest-utils if growpart is not available:

apt install -y cloud-guest-utils

Then grow the root partition to fill all available space:

growpart /dev/sda 1

Note the space between the device and the partition number.

Resize the filesystem

For ext4 (the default for Debian cloud images):

resize2fs /dev/sda1

This works online; no reboot is required.

Verify

df -h /

The root filesystem should now reflect the new size.