Resize root partition

Vallabhaneni Sree Lasya
3 min readSep 28, 2020


We cannot predict what comes in the future even the size needed for the root partition

Redwood Forest — Captured by Kishan Vallabhaneni

I am going to explain how to increase the size of ext4 in the root partition without restarting the server.

Before proceeding I would like to mention it is always recommended and good practice to backup the partition when it is not mounted since resizing a live partition a risk-related activity. The new size must be greater than the size of the existing data if not there will be data loss. This tutorial focuses on resize of Ext2, Ext3, or Ext4

If you are interested to know about the types of file systems in detail. You can refer to this article.

Check the partitions present in the system that are mounted by command:

df -h

Go to Partition table of the root device

The above partition is where the root is being mounted. Note down the sector number that is in the start section which is 4096 which we are going to use this start point when we recreate a larger partition.

If you need any help with commands and what they do you can press m

Press m for options to look for help

Delete the existing partition with 'd'

Deleting the partition

Type n for creating a new partition and follow the commands to create a primary partition with the same starting sector as before.

Creating a new partition

You can leave the last sector as default by not entering any number and just press enter.

Successful creation of new partition

Observe the partition table by command ‘p’ and see the device has started with 4096. If you observe our previous partition it had boot flag as ‘*’.

To make the partition bootable — Press ‘a’ to enable it

Partition is bootable

Save the new partition information with the command ‘w’ and you will exit out of the partition table.

To resize the partition run the command:

Run resize2fs /dev/sda1

Output, when resize, is successful

Without any restart, the root file system will be resized to the new size.

Resized root to 25G



Vallabhaneni Sree Lasya

Software Engineer who enjoys writing, cooking, eating, travelling, working, maturing in all aspects of life :)