How to reduce or increase the size of a Linux partition

Home > Search > How-to

The partition must be deleted and then recreated. For this reason, if there is any data on the partiton that is needed, backup up the data on the partition before proceeding.

Ensure you are not deleting the / (root) or /boot partition. Deleting the / (root) partitoin will ruin your system, and the entire system will need to be recreated from scratch. Deleting the /boot partition will result in your system being unable to boot. Check /etc/fstab to ensure you do not delete the / (root) or /boot partition.

~]# cat /etc/fstab
xxxxxxx-xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx   /      xfs   defaults   0   0
xxxxxxx-xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx   /boot  xfs   defaults   0   0


Creating LVM volumes is an ideal solution to this problem, because with LVM, there is no need to delete and recreate the partition. With LVM, volumes can easily be increased or reduced.


Delete the partition

In this example, the /dev/sda4 parition mounted on /mnt will be resized.

After backing up the data on /dev/sda4, unmount /dev/sda4.

~]# umount /mnt


Use fdisk to delete the partition.

~]# fdisk /dev/sda


Delete the fourth partitoin (/dev/sda4).

Command (m for help): d


Select the partition number, where 1 is /dev/xxx1, 2 is /dev/xxx2, et cetera.

Partition number (2-4, default 4): 4


Select w to write the changes and q to quit fdisk.

Command (m for help): w


Type and press enter to quit fdisk.

Command (m for help): q


Use the partprobe command to inform the system that /dev/sda4 has been removed.

~]# partprobe


Create the partition

Use fdisk to create the partition.

~]# fdisk /dev/sda


Type and press enter to create a new partition.

Command (m for help): n


Type (primary partition) and press enter.

Select (default p): p


Type 4 and press enter.

Partition number (2-4, default 2): 4


When prompted First sector, press enter to use the default first sector.

First sector (1234567-3456789, default 1234567):


When prompted Last sector, enter the size of the partition (such as +1GB or +512MB).

Last sector (1234567-3456789, default 1234567): +1GB


Type w and press enter to write the changes.

Command (m for help): w


Use the partprobe command to inform the system that /dev/sda4 has been created.

~]# partprobe

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.