Post

How to Expand Storage in Proxmox Virtual Machines

How to Expand Storage in Proxmox Virtual Machines

When running virtual machines in Proxmox, you might eventually need to increase their storage capacity. This post walks through the process of expanding the disk space for a Proxmox VM and ensuring the guest operating system recognizes the additional space.

The Process Overview

  1. Expand the virtual disk in Proxmox
  2. Start the VM
  3. Inside the VM, expand the partition
  4. Resize the filesystem to use the new space

Step-by-Step Commands

1. Expand the Virtual Disk

First, we need to add space to the virtual disk. In this example, I’m adding 20GB to SCSI disk 0 of VM ID 101:

1
qm resize 101 scsi0 +20G

This command tells Proxmox to increase the size of the first SCSI disk (scsi0) attached to VM 101 by 20 gigabytes.

2. Start the VM

After resizing the disk, start the VM:

1
qm start 101

3. Expand the Partition

Once inside the running VM, we need to expand the partition to use the newly available space. The growpart utility (part of the cloud-utils package on many distributions) makes this easy:

1
sudo growpart /dev/sda 1

This expands partition 1 on disk /dev/sda to fill the available space. Note that you may need to modify the device name and partition number based on your specific setup.

4. Resize the Filesystem

Finally, we need to expand the filesystem to utilize the new partition size:

1
sudo resize2fs /dev/sda1

This command resizes the ext2/ext3/ext4 filesystem on /dev/sda1 to fill the expanded partition. If you’re using another filesystem type like XFS, you would use xfs_growfs instead.

Verification

After completing these steps, you can verify the new size using:

1
df -h

This will show you the available space on your filesystems, which should now include the additional 20GB we added.

Notes

  • Always back up your VM before performing storage operations
  • Different guest operating systems might require slightly different approaches
  • For LVM-based systems, you’ll need to use LVM commands to extend logical volumes after expanding the partition

This simple process allows you to easily expand storage on your Proxmox VMs without downtime (except for the brief restart) or data migration.

This post is licensed under CC BY 4.0 by the author.