How to Resize the File System of Your VM After Increasing in Proxmox

Proxmox VE is an open-source server virtualization platform that enables running and managing virtual machines on x64 hardware. It is a hosted hypervisor that supports Linux and Windows systems with full KVM virtualization.

Proxmox has a web-based interface and is licensed under GNU AGPL v3. It can be useful if you host pet projects on your hardware or create complex systems at work.

To create a working Proxmox VE instance, you must deploy it using a Debian-based distribution. After that, you can create, update, and delete virtual machines. However, you may encounter a situation when the disk size you created is smaller than you need.

Resizing the file system in the Proxmox UI is easy. Go to VM -> Hardware -> click on the disk to resize -> click the "Resize disk" button. But after this operation, you need to resize your disk in the VM.

Confirm an increase in disk space

Log in to the VM and check the current partition size using the command df -h. This will show you the current disk usage and partition sizes.

Confirm that the disk space has been increased by running the command lsblk. This will show you the current disk size and available space.

lsblk

Resize the partition

Next, resize the partition using the command sudo partedter /dev/vda. Once in the parted shell, enter resizepart 3 100% (assuming your partition is number 3) and then quit.

sudo parted /dev/vda
(parted) print
(parted) resizepart 3 100%
(parted) quit

Extend the logical volume

Now it's time to extend the logical volume using the command sudo lvextend -r -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv (assuming your logical volume is named "ubuntu--vg-ubuntu--lv).

sudo lvextend -r -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv

Resize the physical volume

After that, resize the physical volume using the command sudo pvresize /dev/vda3 (assuming your physical volume is named /dev/vda3).

sudo pvresize /dev/vda3

Confirm resize completion

Finally, confirm that the resize is complete by running lsblk again.

lsblk

That's it! You have successfully resized the file system of your VM after increasing it in Proxmox. Note that these steps can vary depending on your specific setup and configuration.

I recommend backing up your data before making any changes and confirming that the increase in disk space has been successfully applied before proceeding with any further changes or operations.

Subscribe to The Code Sandwiches

Sign up now to get access to the library of members-only issues.
Jamie Larson
Subscribe