New partition size does not show up when running df -h

Hi, Everyone.

I hope you can help me with my problem, I have an ubuntu server 20.04. It is vmguest in xcp-ng. The root partition was originally 20 GB. Since it already used up most of the space I need to increase the capacity to 30 GB. I have done this using parted:

Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  32.2GB  32.2GB

If I perform “fdisk -l” it sees that the size has increased

user1@graylog1:~$ sudo fdisk -l

Disk /dev/xvda: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F0D97B47-EBC7-410D-88EF-D826038D110E

Device     Start      End  Sectors Size Type
/dev/xvda1  2048     4095     2048   1M BIOS boot
/dev/xvda2  4096 62890625 62886530  30G Linux filesystem

but if I run df -h it is still showing 20 GB

user1@graylog1:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G     0  1.9G   0% /dev
tmpfs           391M  1.1M  390M   1% /run
/dev/xvda2       20G   18G  847M  96% /

Hope you can show me how to properly extend my partition to show up in df -h

If it’s an ext4 filesystem you can use resize2fs to do that.

1 Like