How to Increase or Decrease the Size of Static Partition in Linux.

Rithik Sharma
2 min readMar 14, 2021

In this task we can increase or decrease the size of static partition in Linux by following these steps:

Check partitions using command:

fdisk -l

Now we will make a partition and put some data in it:

fdisk <device name>

Now format the partition by using:-

mkfs.ext4 <device name>

Now we will mount the folder!

mount <partition name> <location>

Here you can see in the last /dev/xvdf1 is mounted to folder1.

Now we add some data in the folder1 :-

To increase/decrease the size we unmount it!

umount <device name>

Now we delete the partition again by accessing the fdisk prompt.

After the partition is deleted we again create a partition using fdisk with the same device name. But this time in the option we will give +4GB.

You can also check for error by using command

e2fsck -f <device name>

The size of the partiton is increased to 4GB but it is not formatted into ext4 format, so we use command:-

resize2fs /dev/xvdf1
This will format the new sectors into ext4 format, and now we can mount it back to the folder1 .

Now we have the size of the our Partition is increased from 2GB to 4GB.

This will format the new sectors into ext4 format, and now we can mount it back to the folder1 .

--

--