It’s a common scenario: you set up a Proxmox Virtual Machine, allocate some disk space, and later find yourself needing more room for applications, data, or updates. While Proxmox makes it easy to add space at the hypervisor level, telling the guest operating system (especially if it uses LVM) to recognize and use that new space requires a few command-line steps inside the VM.
This guide walks you through the process, building on the successful steps you took. We’ll assume your VM uses Logical Volume Management (LVM) for its root partition, which is a common setup for many Linux distributions.
Important Prerequisite: Before you start, ALWAYS back up your VM! While this process is standard, unexpected issues can occur, and having a recent backup is your safety net.
Assumptions:
- You have a Proxmox VM where you’ve increased the virtual disk size in the Proxmox GUI.
- Your VM’s root filesystem is on an LVM Logical Volume (LV).
- You have SSH access to your VM or can access its console.
- You have
sudo
privileges on the VM.
Let’s get started!
Step 1: Increase Disk Size in Proxmox (Hypervisor Level)
(This step is done before you follow the commands below, but it’s the crucial first action).
- Log in to your Proxmox web interface.
- Select the VM you want to resize.
- Go to the “Hardware” section.
- Select the virtual hard disk you want to resize.
- Click the “Resize Disk” button from the “Disk Action” toolbar.
- Enter the additional space you want to add (e.g., if your disk is 20GB and you want to make it 50GB, enter
30
GB). - Click “Resize”.
Once the task is complete in Proxmox, log in to your VM. The operating system won’t immediately see the extra space; we need to tell it about the changes.
Step 2: Connect to Your VM and Identify the Disk
Log in to your VM via SSH or the Proxmox console. The first step inside the VM is to see how the disk is structured and identify the partition that contains your LVM setup.
Run the lsblk
command:
lsblk
Look at the output carefully. You’ll see your main disk (often /dev/sda
or /dev/vda
in virtual environments) and its partitions (sda1
, sda2
, sda3
, etc.). Identify the partition that is being used for your LVM Physical Volume (PV). This is typically the largest partition and will have an LVM structure nested underneath it in the lsblk
tree, like this:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 63.7M 1 loop /snap/core20/2496
loop1 7:1 0 44.4M 1 loop /snap/snapd/23771
sda 8:0 0 40G 0 disk # Your main disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1.8G 0 part /boot
└─sda3 8:3 0 8.2G 0 part # This is our LVM partition!
└─ubuntu--vg-ubuntu--lv 252:0 0 8.2G 0 lvm / # And this is the Logical Volume (LV)
sr0 11:0 1 1024M 0 rom
In this example (above), the main disk is /dev/sda
, and the partition containing the LVM setup is /dev/sda3
. The Logical Volume (LV) is named ubuntu--vg-ubuntu--lv
and is mounted as the root filesystem (/
). Note these names down, as you’ll need them in the following steps.
You can see that although the sda
disk is now showing the total new size (40G in this example), the sda3
partition and the ubuntu--vg-ubuntu--lv
Logical Volume within it are still showing the old size (8.2G).
Step 3: Extend the Partition
Now, we need to extend the specific partition (/dev/sda3
in our example) to use the newly available space on the disk. We use the growpart
command for this.
The command takes two arguments: the disk name and the partition number. Make sure there is a space between the disk name and the partition number.
sudo growpart /dev/sda 3
(Replace /dev/sda
with your disk name and 3
with your LVM partition number if they are different).
You should see output similar to this, indicating that the partition has been successfully resized:
CHANGED: partition=3 start=3674112 old: size=17295360 end=20969471 new: size=80211935 end=83886046
Note: If growpart
is not found, you may need to install the cloud-guest-utils
package: sudo apt update && sudo apt install cloud-guest-utils
(for Debian/Ubuntu based systems).
You can run lsblk
again if you like to confirm the partition size has increased (you’ll see /dev/sda3
is now larger).
Step 4: Update LVM Physical Volume
The growpart
command resized the partition, but LVM doesn’t automatically know about this extra space yet. We need to tell the LVM Physical Volume (PV) associated with that partition to scan for and incorporate the new space.
Use the pvresize
command, specifying the partition device:
sudo pvresize /dev/sda3
(Again, replace /dev/sda3
with your LVM partition device if it’s different).
The output should confirm the change:
Physical volume "/dev/sda3" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
LVM is now aware that the physical volume /dev/sda3
is larger.
Step 5: Extend the LVM Logical Volume
The physical volume knows it’s bigger, but the Logical Volume that your filesystem sits on hasn’t been told to grow yet. We now extend the Logical Volume to utilize the new space available in its Volume Group.
We’ll use the lvextend
command. The -l +100%FREE
option is very useful as it tells LVM to extend the LV to consume all available free space in the Volume Group.
You need the full path to your Logical Volume. From the lsblk
output, this was /dev/mapper/ubuntu--vg-ubuntu--lv
.
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
(Replace /dev/mapper/ubuntu--vg-ubuntu--lv
with your specific LV path if it differs).
You’ll see output indicating the size change for the Logical Volume:
Size of logical volume ubuntu-vg/ubuntu-lv changed from <8.25 GiB (2111 extents) to <38.25 GiB (9791 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
Your Logical Volume is now the correct, larger size!
Step 6: Resize the Filesystem
This is the final piece. The partition is extended, the Physical Volume is updated, and the Logical Volume is larger. However, the filesystem itself (like ext4 or XFS) that resides on the Logical Volume still thinks it’s the old size. We need to resize the filesystem to fill the expanded Logical Volume.
For an ext4 filesystem (common for root partitions), use the resize2fs
command, again specifying the Logical Volume path:
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
(Replace /dev/mapper/ubuntu--vg-ubuntu--lv
with your specific LV path).
The output will show the filesystem resizing process, typically mentioning blocks being processed:
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desired_size = 2111488 (4k blocks)
new_desired_size = 9790464 (4k blocks)
... (some output about resizing) ...
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 9790464 (4k blocks) long.
Step 7: Verify the New Size
Now that all the underlying layers and the filesystem have been resized, you can finally check the available space using the df -h
command:
df -h
Look at the line corresponding to your root filesystem (/
, mounted on /
). Its size should now reflect the total new size you allocated in Proxmox!
Filesystem Size Used Avail Use% Mounted on
tmpfs 795M 1004K 794M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 38G 6.1G 30G 17% / # Success!
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/sda2 1.7G 96M 1.5G 6% /boot
tmpfs 795M 12K 795M 1% /run/user/1000
Congratulations! You have successfully resized your Proxmox VM’s disk and extended the LVM logical volume and filesystem to use the new space.
This sequence of commands (growpart
, pvresize
, lvextend
, resize2fs
) is the standard method for expanding LVM-based filesystems after increasing the underlying disk size. Remember that the exact device names and paths might vary slightly depending on your VM’s configuration and distribution, so always refer to your lsblk
output.