Example showing how I resized an Ubuntu server from 10GB to 40GB
I had resized with VirtualBox (like increasing physical medium)
# /dev/sda2 looks like our main drive mount (its full)
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 969M 0 969M 0% /dev
tmpfs 200M 968K 199M 1% /run
/dev/sda2 9.8G 9.3G 372K 100% /
tmpfs 1000M 0 1000M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1000M 0 1000M 0% /sys/fs/cgroup
/dev/loop0 94M 94M 0 100% /snap/core/8935
/dev/loop1 15M 15M 0 100% /snap/aws-cli/130
/dev/loop2 90M 90M 0 100% /snap/core/8268
tmpfs 200M 0 200M 0% /run/user/1000
# lsblk command displays information about the block devices attached
# that disk has two partitions (partition 2 is the main storage space)
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 93.8M 1 loop /snap/core/8935
loop1 7:1 0 15M 1 loop /snap/aws-cli/130
loop2 7:2 0 89.1M 1 loop /snap/core/8268
sda 8:0 0 40G 0 disk
├─sda1 8:1 0 1M 0 part
└─sda2 8:2 0 10G 0 part /
sr0 11:0 1 1024M 0 rom
# grow second partition to fill the HD space available
$ sudo growpart /dev/sda 2
CHANGED: partition=2 start=4096 old: size=20965376 end=20969472 new: size=83881951,end=83886047
# now it shows the partition has grown
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
...
sda 8:0 0 40G 0 disk
├─sda1 8:1 0 1M 0 part
└─sda2 8:2 0 40G 0 part /
...
# but the mount has not scaled because we need to extend file system
$ df -h
Filesystem Size Used Avail Use% Mounted on
...
/dev/sda2 9.8G 9.3G 372K 100% /
...
# resize2fs will resize ext2, ext3, or ext4 file systems, mounted or unmounted
# extend it
$ sudo resize2fs /dev/sda2
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 5
The filesystem on /dev/sda2 is now 10485243 (4k) blocks long.
# DONE!
$ df -h
Filesystem Size Used Avail Use% Mounted on
...
/dev/sda2 40G 9.3G 29G 25% /
...