Identify the root partition
findmnt / -o source -n
You should get something like /dev/sda1 or /dev/vda2. If you receive /dev/mapper/something, you probably use lvm, and this tutorial won’t be enough.
Display the partition table with some information
root@vps:~# parted /dev/vda
GNU Parted 3.2
Using /dev/vda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 6442MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 5369MB 5368MB primary ext4 boot
Resize the partition
(parted) resizepart
Partition number? 1 << the number of the partition you want resize
Warning: Partition /dev/vda1 is being used. Are you sure you want to continue?
Yes/No? Yes
End? [5369MB]? 100% << 100% means we want use all the space available
Check the change has been done correctly
(parted) print
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 6442MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 6442MB 6441MB primary ext4 boot
(parted) q
Information: You may need to update /etc/fstab.
Resize the file system
root@vps:~# resize2fs /dev/vda1
resize2fs 1.43.4 (31-Jan-2017)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/vda1 is now 1572608 (4k) blocks long.