
How to Increase Hard Drive Size for an Ubuntu VM in Proxmox
When running virtual machines in Proxmox, you may eventually need to increase the disk size as your storage requirements grow. This guide walks you through the process of resizing an Ubuntu VM’s hard drive in Proxmox and extending the filesystem to use the new space.
The entire process can typically be completed in just a few minutes with no data loss when performed correctly.
Prerequisites
- Access to the Proxmox web interface or SSH access to the Proxmox host
- Root or sudo access to the Ubuntu VM
- A backup of your VM (recommended before any disk operations)
Overview
The process involves three main steps:
- Resize the virtual disk in Proxmox
- Extend the partition inside the Ubuntu VM
- Resize the filesystem to use the new space
Step 1: Resize the Virtual Disk in Proxmox
Using the Proxmox Web Interface
- Shut down the VM (recommended, though not always required)
- Select your VM in the Proxmox interface
- Click “Shutdown” and wait for it to complete
- Navigate to the Hardware section
- Click on “Hardware” in the left menu
- Resize the disk
- Select the hard disk you want to resize
- Click “Disk Action” at the top
- Select “Resize”
- Enter the amount of space to add (not the final size)
- Example: Enter
50to add 50GB to the current size - Click “Resize disk”
Using the Command Line (Alternative)
If you prefer using SSH to your Proxmox host:
# Resize the disk by adding space (example: adding 50GB to VM 100's scsi0 disk)
qm resize 100 scsi0 +50G
Replace 100 with your VM ID and scsi0 with your disk identifier if different.
Step 2: Extend the Partition in Ubuntu
Now start your VM and log in. You’ll need to extend the partition to recognize the new space.
Check Current Disk Layout
First, verify your current setup:
lsblk
You should see output similar to:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 48G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 48G 0 lvm /
Notice that sda shows the new size (100G in this example), but the partitions haven’t been extended yet.
For LVM-Based Installations (Most Common)
Most Ubuntu server installations use LVM by default. Here’s how to extend:
# Install parted if not already available
sudo apt-get update
sudo apt-get install parted -y
# Extend the partition to use all available space
sudo parted /dev/sda resizepart 3 100%
# Extend the physical volume
sudo pvresize /dev/sda3
# Check the volume group for available space
sudo vgdisplay
# Extend the logical volume (use all free space)
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
# Resize the filesystem
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
Note: Your volume group and logical volume names may differ. Check the output of lsblk and adjust the paths accordingly (e.g., /dev/mapper/ubuntu--vg-ubuntu--lv).
Step 3: Verify the Changes
Check that the filesystem now reflects the new size:
df -h
You should see your root filesystem (or whichever partition you resized) now showing the increased space.