Overview
This guide details the process of increasing the virtual disk size of a Fedora Linux VM running on Proxmox, assuming the typical LVM plus XFS configuration. The procedure involves resizing the virtual disk in Proxmox, then expanding the partition, physical volume, logical volume, and XFS filesystem inside the guest.
Prerequisites
- Backup the VM or take a Proxmox snapshot before resizing.
- Access to the Proxmox web interface.
- SSH access to the Fedora VM.
- The
cloud-utils-growpartpackage installed in the guest (install withsudo dnf install cloud-utils-growpartif missing).
Step 1: Shut Down the VM
Shut down the Fedora VM before resizing its virtual disk:
sudo shutdown -h nowAlternatively, shut down the VM through the Proxmox web interface.
Step 2: Increase Virtual Disk Size in Proxmox
In the Proxmox web interface:
- Select the Fedora VM.
- Open Hardware.
- Select the virtual disk.
- Choose Disk Action → Resize.
- Enter the additional storage to add (not the final disk size).
- Click Resize disk.
- Start the VM.
Example: If the current disk is 32 GB and the desired size is 64 GB, increase it by 32 GB.
Step 3: Verify New Disk Size
After the VM starts, run:
lsblkThe disk size should reflect the new capacity. However, the LVM partition will still show the old size, indicating that the newly available space must be added to the partition.
Step 4: Identify LVM Partition
Run the following commands to identify the storage layout:
lsblk -f
sudo pvsExample output from pvs:
| PV | VG | Fmt | Attr | PSize | PFree |
|---|---|---|---|---|---|
| /dev/sda3 | fedora | lvm2 | a— | <30.00g | 0 |
In this example:
- Disk:
/dev/sda - LVM partition:
/dev/sda3 - Partition number:
3 - Volume group:
fedora
Common device names include /dev/sda3, /dev/vda3, and /dev/nvme0n1p3. Always identify your actual devices before proceeding.
Step 5: Expand the LVM Partition
Use growpart to extend the partition into the newly available disk space:
sudo growpart /dev/sda 3Replace /dev/sda and 3 with your actual disk and partition number.
Verify the partition size:
lsblkThe LVM partition should now occupy most or all of the newly available disk space.
Step 6: Expand the LVM Physical Volume
Tell LVM that the physical volume has become larger:
sudo pvresize /dev/sda3Verify the result:
sudo pvsThe PSize column should have increased, and PFree should now be greater than zero.
Step 7: Identify Root Logical Volume
List the logical volumes:
sudo lvsExample output:
| LV | VG | Attr | LSize |
|---|---|---|---|
| root | fedora | -wi-ao---- | 28.00g |
| swap | fedora | -wi-ao---- | 2.00g |
The root logical volume is commonly named root. You can also inspect the filesystem mounted at /:
findmnt /This confirms the root filesystem type and identifies the device backing /.
Step 8: Expand the Root Logical Volume
Allocate all remaining free space in the volume group to the root logical volume:
sudo lvextend -l +100%FREE /dev/fedora/rootReplace fedora and root with your actual volume group and logical volume names.
Verify the new size:
sudo lvsThe root logical volume should now be larger.
Step 9: Expand the XFS Filesystem
The logical volume is now larger, but the XFS filesystem must also be expanded:
sudo xfs_growfs /Note: Do not use resize2fs for XFS. That utility is intended for ext2/ext3/ext4 filesystems. Use xfs_growfs for a mounted XFS filesystem.
Step 10: Verify Results
Check the available space on the root filesystem:
df -h /Example output:
| Filesystem | Size | Used | Avail | Use% | Mounted on |
|---|---|---|---|---|---|
| /dev/mapper/fedora-root | 60G | 15G | 45G | 25% | / |
Check the block devices:
lsblkCheck the LVM configuration:
sudo pvs
sudo vgs
sudo lvsA successful configuration shows the entire chain expanded from Proxmox virtual disk through partition, physical volume, logical volume, to the XFS filesystem mounted at /.
Quick Reference
Assuming the following configuration:
| Setting | Value |
|---|---|
| Disk | /dev/sda |
| LVM partition | /dev/sda3 |
| Volume group | fedora |
| Root logical volume | root |
| Root filesystem | XFS |
Run the following commands in order, substituting your actual device and volume names:
# Inspect the current layout
lsblk -f
sudo pvs
sudo vgs
sudo lvs
findmnt /
# Expand the partition
sudo growpart /dev/sda 3
# Expand the LVM physical volume
sudo pvresize /dev/sda3
# Allocate all free LVM space to the root logical volume
sudo lvextend -l +100%FREE /dev/fedora/root
# Expand the XFS filesystem
sudo xfs_growfs /
# Verify the results
df -h /
lsblk
sudo pvs
sudo vgs
sudo lvsTroubleshooting
growpart: command not found
Install the required package:
sudo dnf install cloud-utils-growpartThen retry with the correct disk and partition number.
pvresize reports no change
Check the partition size:
lsblkThen check the physical volume:
sudo pvsIf the partition was not expanded, run growpart again with the correct disk and partition number.
lvextend reports that there is no free space
Check the volume group:
sudo vgsLook at the VFree column. If it shows 0, the volume group has no unallocated space available.
If the physical volume has not been expanded, run:
sudo pvresize /dev/sda3Replace /dev/sda3 with your actual LVM partition.
df -h still shows the old size
First, verify that the logical volume has been expanded:
sudo lvsIf the logical volume is larger but the filesystem still reports its previous size, run:
sudo xfs_growfs /Then verify again:
df -h /Recommended Pre-Resize Checklist
When working with an unfamiliar Fedora VM, collect the storage layout before making changes:
lsblk -f
sudo pvs
sudo vgs
sudo lvs
findmnt /Document the following:
- Disk: For example,
/dev/sda - LVM partition: For example,
/dev/sda3 - Volume group: For example,
fedora - Root logical volume: For example,
fedora/root - Filesystem: For example, XFS
- Mount point:
/
Once identified, the resize workflow is:
Increase virtual disk in Proxmox
↓
growpart
↓
pvresize
↓
lvextend
↓
xfs_growfs /
↓
Verify
df -h /
Summary
For a Fedora VM using LVM and XFS, increasing the virtual disk size in Proxmox is only the first step. The complete process is:
- Proxmox: Increase the virtual disk size.
- Partition: Expand the LVM partition with
growpart. - LVM physical volume: Expand it with
pvresize. - LVM logical volume: Allocate the additional space with
lvextend. - XFS filesystem: Expand it with
xfs_growfs. - Verification: Confirm the resulting sizes with
df -h,lsblk,pvs,vgs, andlvs.
The most important rule is to identify your actual disk, partition, volume group, and logical volume before running any resize commands.