Project

General

Profile

Increase an Ubuntu Virtual Machine Disk

Wiki
11/05/2025

Increase an Ubuntu Virtual Machine Disk

Use the following guide to increase an Ubuntu virtual machine disk space hosted in a Proxmox Virtual Environment.

Increase the Virtual Machine Disk Size

Shutdown the virtual machine and perform the following to increase the virtual machine disk size setting.

  1. Open the virtual machine's Hardware setting in the Proxmox Virtual Environment.
  2. Select the hard disk from the virtual machine hardware settings and click on the Disk Action button and select "Resize" from the drop down menu.
  3. Enter a size increment in GiB and click the "Resize disk" button

Increase Disk Partition

Start and login to the virtual machine and perform the following to use the available disk size inside the operating system.

Verify the New Increased Disk Size

Verify that the new increased disk size with the following command:

sudo lsblk

This should output something similar to the following.

frank@dns-0:/var/log$ sudo lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda                         8:0    0   15G  0 disk
├─sda1                      8:1    0    1M  0 part
├─sda2                      8:2    0  1.8G  0 part /boot
└─sda3                      8:3    0 13.2G  0 part
  └─ubuntu--vg-ubuntu--lv 252:0    0 13.2G  0 lvm  /
sr0                        11:0    1 1024M  0 rom

In this example, the sda disk has been increased to 15G.

Grow the Partition

Use the growpart command to grow the partition as shown here.

sudo growpart /dev/sda 3

CHANGED: partition=3 start=3674112 old: size=17297408 end=20971519 new: size=27787231 end=31461342

This increases partition 3 (sda3) from the given example.

Resize the Physical Volume

Resize the physical volume (pv) using the pvresize command.

sudo pvresize /dev/sda3

  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

Extend the Logical Volume

Extend the logical volume (LV) to use the new free space.

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

  Size of logical volume ubuntu-vg/ubuntu-lv changed from <8.25 GiB (2111 extents) to <13.25 GiB (3391 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.

Resize the File System

Resize the file system to apply the changes.

sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

resize2fs 1.47.0 (5-Feb-2023)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 2
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 3472384 (4k) blocks long.

Verify the New Size

Use df to verify the new size

df -h

Filesystem                         Size  Used Avail Use% Mounted on
tmpfs                              197M  720K  197M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   13G  6.9G  5.5G  56% /
tmpfs                              984M   12M  973M   2% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
/dev/sda2                          1.7G  191M  1.4G  12% /boot
tmpfs                              197M   12K  197M   1% /run/user/1000

Files