I have bought additional disk space for my VPS, which is running Ubuntu 16.04. enter image description here

to add the unallocated space to the root partition, I do think I have to boot the system by a live media to be able to add the unallocated space to the extended partition. If this is way I have to pass, How is it possible to boot this system by a live Ubuntu while my only access to it is just an ssh connection?

  • You don't necessarily have to. growpart is your friend, aswell as resize2fs. See askubuntu.com/a/937351/672946 – Panki Aug 26 '19 at 11:30
  • Thank you so much, The "sudo growpart /dev/sda 2" which means Extend partition 2 in /dev/sda to fill empty space until end of disk or next partitiong included the unallocated partition to extended partition, so now on am able to resize it by Gparted – hosh0425 Aug 26 '19 at 11:47

Panki's idea is right; growpart can stretch your ext4 partition to fit the contiguous space available without your physical presence or a reboot from installation media.

First, run sudo growpart --help to confirm you have it already; if you don't then run sudo apt install cloud-utils.

However, please back up your data and configuration first! Use your normal backup method for the data; for the partition table, use sfdisk {drive} {partition}, a lá: sfdisk -d /dev/sda2 > partition_bak.dmp before you run sudo growpart /dev/sda 2 and resize2fs /dev/sda2 to first enlarge the partition, then the filesystem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.