VM Disk Expansion Guide (Proxmox + Linux)
Tags: #proxmox #storage #filesystem #resize
Quick Reference
Expanding a VM disk is a 3-step process: 1. Proxmox: Increase virtual disk size 2. Guest OS: Expand the partition 3. Guest OS: Resize the filesystem
Step 1: Increase Disk Size in Proxmox
Via Web UI
1. Select VM → Hardware
2. Click on Hard Disk (scsi0)
3. Click "Resize disk" button
4. Enter size to add (e.g., +50)
5. Click "Resize disk"
Via CLI (Proxmox Host)
# Increase VM 100's disk by 50GB
qm resize 100 scsi0 +50G
# Verify
qm config 100 | grep scsi0Result: Virtual disk is larger, but guest OS doesn’t see it yet.
Step 2: Expand Partition (Inside VM)
Check Current Situation
# View disk and partition layout
lsblk
# Example output:
# sda 8:0 0 150G 0 disk ← Disk is 150G
# └─sda2 8:2 0 100G 0 part / ← Partition still 100GExpand the Partition
Method A: Using growpart (Recommended)
# Install if needed
sudo apt install cloud-guest-utils
# Expand partition 2 on /dev/sda
sudo growpart /dev/sda 2
# Verify
lsblk
# sda2 should now show 150GMethod B: Using parted
# Interactive mode
sudo parted /dev/sda
(parted) print free # Show layout
(parted) resizepart 2 100% # Resize partition 2 to 100%
(parted) quit
# Non-interactive
sudo parted /dev/sda resizepart 2 100%Method C: Using fdisk (Advanced)
# Only if above methods fail
sudo fdisk /dev/sda
# Type: d, 2 (delete partition 2)
# Type: n, p, 2, <enter>, <enter> (recreate larger)
# Type: w (write changes)
# Reboot if partition in useStep 3: Resize Filesystem (Inside VM)
For ext4 Filesystem (Ubuntu/Debian)
# Resize filesystem to fill partition
sudo resize2fs /dev/sda2
# Verify
df -h /For XFS Filesystem (CentOS/RHEL)
# Resize XFS filesystem
sudo xfs_growfs /
# Verify
df -h /For Btrfs Filesystem
# Resize Btrfs filesystem
sudo btrfs filesystem resize max /
# Verify
df -h /Complete Example Walkthrough
Scenario: Expand Ubuntu VM from 100GB to 150GB
Step 1: Proxmox Host
# Add 50GB to VM 100
qm resize 100 scsi0 +50GStep 2: Inside Ubuntu VM
# Check current state
lsblk
df -h /
# Output shows:
# Disk: 150G, Partition: 100G, Filesystem: 99G
# Expand partition
sudo growpart /dev/sda 2
# Check partition expanded
lsblk
# Output now shows: Partition: 150G
# Expand filesystem
sudo resize2fs /dev/sda2
# Verify final result
df -h /
# Output now shows: Filesystem: 148G (150GB - overhead)Success! Your VM now has 50GB more space.
Troubleshooting
Issue: Partition Won’t Expand
Symptom:
sudo growpart /dev/sda 2
# Error: no space to growSolution:
# Check if Proxmox resize worked
lsblk
# Look at sda size - should be larger
# If sda size is still old:
# - Shutdown VM
# - Resize again in Proxmox
# - Start VMIssue: “GPT PMBR size mismatch” Warning
Symptom:
sudo fdisk -l /dev/sda
# GPT PMBR size mismatch (209715199 != 314572799)Solution: This is normal and will be fixed automatically when you resize the partition.
# Fix GPT table
sudo parted /dev/sda
(parted) print
# Answer 'Fix' when prompted
(parted) quitIssue: “Filesystem is mounted, can’t resize”
For ext4:
# ext4 supports online resizing
sudo resize2fs /dev/sda2
# This works while mountedFor XFS:
# XFS must be mounted to resize
sudo xfs_growfs /
# Uses mount point, not deviceFor others:
# May need to unmount or use live CD
# Boot from live USB
# Run resize2fs /dev/sda2
# RebootIssue: Partition Doesn’t Use Full Disk
Check unallocated space:
sudo parted /dev/sda print free
# Shows something like:
# Number Start End Size File system Name
# 1 1049kB 2097kB 1049kB
# 2 2097kB 107GB 107GB ext4
# 107GB 161GB 53.7GB Free Space ← UnallocatedSolution: Expand the partition (Step 2 above)
Different Disk Naming Schemes
| VM Disk Type | Linux Device | Usage |
|---|---|---|
| IDE | /dev/hda | Old, slow |
| SCSI | /dev/sda | Common |
| VirtIO Block | /dev/vda | Fastest (recommended) |
| VirtIO SCSI | /dev/sda | Fast + TRIM support |
Adjust commands accordingly: - VirtIO: Use
/dev/vda instead of /dev/sda - Multiple disks:
/dev/sdb, /dev/sdc, etc.
Pre-Flight Checklist
Before expanding disk:
-
# In Proxmox qm config <vmid> | grep scsi0 # In VM df -h / lsblk
Post-Expansion Verification
# In VM - verify everything
lsblk # Disk and partition sizes
df -h # Filesystem size and usage
sudo parted /dev/sda print # Partition table
# Should all show new larger sizesCommon Disk Sizes
| Original | Add | Final | Use Case |
|---|---|---|---|
| 32G | +18G | 50G | Minimal server |
| 100G | +50G | 150G | Development VM |
| 100G | +100G | 200G | Production workload |
| 200G | +300G | 500G | Database/storage |
Tip: Add space in increments. Easier to add more later than remove.
LVM Scenario (Different Process)
If your VM uses LVM:
# Check if LVM
lsblk
# Look for "lvm" in TYPE column
# Example with LVM
lsblk
# sda
# └─sda2 (physical partition)
# └─ubuntu--vg-root (LVM volume)
# Resize process:
# 1. Proxmox: Increase disk size
qm resize 100 scsi0 +50G
# 2. VM: Expand partition
sudo growpart /dev/sda 2
# 3. VM: Resize physical volume
sudo pvresize /dev/sda2
# 4. VM: Expand logical volume
sudo lvextend -l +100%FREE /dev/ubuntu-vg/root
# 5. VM: Resize filesystem
sudo resize2fs /dev/ubuntu-vg/root
# Verify
df -h /Quick Command Reference
# View disk layout
lsblk
lsblk -f # With filesystem info
sudo parted /dev/sda print # Detailed partition info
sudo fdisk -l /dev/sda # Alternative view
# Check filesystem
df -h # Mounted filesystems
df -h / # Root filesystem specifically
sudo tune2fs -l /dev/sda2 # ext4 details
# Expand operations
sudo growpart /dev/sda 2 # Expand partition
sudo resize2fs /dev/sda2 # Expand ext4
sudo xfs_growfs / # Expand XFS
sudo btrfs filesystem resize max / # Expand Btrfs
# Verify
lsblk && df -h / # Quick check bothReal-World Example
Initial State:
# Proxmox: VM disk = 100GB
# VM: Partition = 100GB
# VM: Filesystem = 99GB (22GB used)Commands Used:
# 1. Proxmox (via web UI):
# Hardware → Disk → Resize → +50
# 2. Ubuntu VM:
sudo apt install cloud-guest-utils
sudo growpart /dev/sda 2
sudo resize2fs /dev/sda2Final State:
# Proxmox: VM disk = 150GB
# VM: Partition = 150GB
# VM: Filesystem = 148GB (22GB used, 120GB free)Result: +49GB usable space gained! ✅
Last Updated: 2025-10-30
Tested On: Proxmox 9.0.3, Ubuntu 25.10
Status: Working procedure ✅