Grow Linux partiton

How to grow Linux VM’s file system.

Use lsblk to see the device where ‘/’ file system is on

In my case its on the sda3 device.

@ubuntu-server-01:~$ lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0                       7:0    0 52.2M  1 loop /snap/aws-cli/1676
loop1                       7:1    0 52.3M  1 loop /snap/aws-cli/1737
loop2                       7:2    0 13.2M  1 loop /snap/canonical-livepatch/359
loop3                       7:3    0 13.4M  1 loop /snap/canonical-livepatch/364
loop4                       7:4    0 63.8M  1 loop /snap/core20/2599
loop5                       7:5    0 63.8M  1 loop /snap/core20/2669
loop6                       7:6    0 73.9M  1 loop /snap/core22/2133
loop7                       7:7    0 73.9M  1 loop /snap/core22/2139
loop8                       7:8    0 89.4M  1 loop /snap/lxd/31333
loop9                       7:9    0 91.4M  1 loop /snap/lxd/35819
loop10                      7:10   0 50.8M  1 loop /snap/snapd/25202
loop11                      7:11   0 50.9M  1 loop /snap/snapd/25577
sda                         8:0    0   96G  0 disk
├─sda1                      8:1    0    1M  0 part
├─sda2                      8:2    0    2G  0 part /boot
└─sda3                      8:3    0   30G  0 part
  └─ubuntu--vg-ubuntu--lv 253:0    0   15G  0 lvm  /

Use cfdisk command

You should see at the bottom Free space

(image goes here)

You need to select the device that you want to grow, in my case its sda3, once hightlighted use the arrow keys to select “Resize” and click enter. After that you will need to use the arrow keys once again to select “Write” and click enter again.

Use pvresize command

Use the pvresize command and select the device that you want to grow again: (You should see output like the one below)

@ubuntu-server-01:~$ sudo pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

Use lvdisplay command

This command will show you the LV Path that you will need for the next command.

@ubuntu-server-01:~$ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/ubuntu-lv
  LV Name                ubuntu-lv
  VG Name                ubuntu-vg
  LV UUID                2pzaCc-eTpE-UzKy-7f8j-0HS1-Feoe-r3Jir0
  LV Write Access        read/write
  LV Creation host, time ubuntu-server, 2025-09-25 15:44:21 +0000
  LV Status              available
  # open                 1
  LV Size                <15.00 GiB
  Current LE             3839
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

Use lvextend command

This command extends the logical volume, you need to pass the LV Path you got from the previous command:

r@ubuntu-server-01:~$ sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
  Size of logical volume ubuntu-vg/ubuntu-lv changed from <15.00 GiB (3839 extents) to <94.00 GiB (24063 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.

Now, if you look at “df -h” you will still see the size of the root partition has not grown:

@ubuntu-server-01:~$ df -h
Filesystem                                     Size  Used Avail Use% Mounted on
tmpfs                                          1.2G  1.5M  1.2G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv               15G   14G  673M  96% /
tmpfs                                          5.9G     0  5.9G   0% /dev/shm
tmpfs                                          5.0M     0  5.0M   0% /run/lock
/dev/sda2                                      2.0G  249M  1.6G  14% /boot
192.168.8.247:/mnt/Media-pool/Central_Library  9.0T     0  9.0T   0% /data
tmpfs                                          1.2G  8.0K  1.2G   1% /run/user/1000

Grow the file system using resize2fs command

This command needs to use the path that is displayed for your root partition in the “df -h” command.

@ubuntu-server-01:~$ sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 12
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 24640512 (4k) blocks long.

victor@ubuntu-server-01:~$ df -h
Filesystem                                     Size  Used Avail Use% Mounted on
tmpfs                                          1.2G  1.5M  1.2G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv               93G   14G   76G  15% /
tmpfs                                          5.9G     0  5.9G   0% /dev/shm
tmpfs                                          5.0M     0  5.0M   0% /run/lock
/dev/sda2                                      2.0G  249M  1.6G  14% /boot
192.168.8.247:/mnt/Media-pool/Central_Library  9.0T     0  9.0T   0% /data
tmpfs                                          1.2G  8.0K  1.2G   1% /run/user/1000

You should see the root partition grew to the size you wanted.


Last modified November 18, 2025: Modify title and description in tutorial (a0803f9)