Expand root partition in Ubuntu 18.04 LTS

02 March 2020 (Monday) 10:46pm

Expanding the root partition always a challenge without any proper knowledge and skills. Tools available in Server Edition like parted and Desktop Edition like gparted. There also a very great tools to used when you are using the Desktop Edition. What about Server Edition. It cannot be a easy way to expand it without unmount the root partition. By default, you cannot unmount root partition. It become the challenging area how you can expand the root partition without any unmount and reboot server to maintenance mode (DVD ISO Boot).

I have done a search on the internet, there have another great tool can solved the issues. It normally uses at Cloud Servers. Many people ask is it working on own premise Ubuntu 18.04 LTS Server? The answer is Yes, you can used this Cloud Utilities Tool. Below is the simple step to expand root partition.

sudo apt -y install cloud-guest-utils



this command is to install the Cloud Utilities Tool into your Ubuntu 18.04 LTS. Before you begin expand your root partition. You need to extend your storage at the virtualize server storage.

lsblk



this command is to show your physical storage size and partition. This show my primary storage (/dev/sda) has 100GB Disk allocation. The root partition has allocated in the primary partition (sda1) of the primary storage (/dev/sda). It has 20GB disk space haven been allocated. We now used this tool to expand the root partition.

sudo growpart /dev/sda 1



this execute the “Growpart” tool in the Cloud utilities Tools. It show you will extend the primary storage (/dev/sda) with the primary patition (1)

sudo resize2fs /dev/sda1



this execute “resize2fs” tool to expand the primary storage in primary storage (/dev/sda1). Once to done you will see the root partition been expanded without unmount the root partition drive. You can simply run lsblk or df -h to verified your root partition successfully expanded.


Flowers