Easy Guide to Resizing Linux Partitions Using GParted

Nidhi Bhatt
5 min readJul 21, 2023

--

Disk space crunch? Allocated way too much space to home partition (/home) and now wanting to shift some of that space to root partition (/) or vice versa? Or in general want to know how to resize disk partitions in Linux? You are in the right place. I will show you the easiest way to resize partitions in Linux from scratch.

In windows we can partition disks without going into a live environment. At max we will be asked to just reboot and the partition manager will take care of the rest.

But in Linux, the process is a bit different. Let’s say we have Ubuntu on our system. I will be focusing on dual booted Ubuntu in this article, but this method will work on pure Linux systems as well.

Step 1: Create a bootable pen drive

You can create it using balena etcher, ventoy (my favourite) or rufus. Point to be noted — rufus only works on windows.

Credit: Ksk Royal

Watch this video from 1:30 mins to 4:30 mins. You’ll get the idea.

Step 2: Boot from the USB and click on Try Ubuntu

This clip will explain this step visually. Do give it a watch. After you click on ‘Try Ubuntu’ you are officially in the live environment.

Step 3: Open GParted in the live system

Usually it would be pre-installed in the live system but in case it isn’t you can install it by running these commands in the terminal.

sudo apt update
sudo apt install gparted -y
gparted
Fig 1: Opening GParted

Step 4 : Partition disks

Now I will explain the steps to partition disk visually. In this example I will be increasing space allocated to root partition by shrinking space from the home partition.

Fig 2: This is how my GParted looks on opening it.

IMPORTANT : Click on swap partition and select swap off. You can partition disks only when swap is off.

Here we can see that I have allocated :

  1. 13 GiB to swap partition.
  2. 85.95 GiB to home partition (ext4 file system)
  3. 110.56 GiB to root partition (ext4 file system)

I want to shrink 8 GiB from /home and give it to /.

Fig 3: Clicked on /home
Fig 4: 1000 MiB is 1 GiB

Shrank ~8 GiB from /home by moving the pointer back. You can even manually enter value in the free space following box : 7921 MiB. We can see the following free space ~8 GiB created.

Fig 5: See the unallocated space!

But we need this free space to be adjacent to the root partition, so that we can extend it.

Fig 6: Can’t extend root partition even with free space

So how do we do that?

We shift the home partition to create free space preceding /home to make it adjacent to the root partition.

Fig 7: Shift /home partition

Just click on the /home and shift it to cover the unallocated space that we created.

You can even manually enter values: 7921 MiB in the free space preceding box and 0 Mib in the free space following box.

Fig 8: This will pop up! Don’t worry click ‘Ok’ and you’ll be fine.

Ok, this pop-up requires some background knowledge. Moving the start of a partition CAN can cause issues, but only if it contains /boot or the EFI boot partition.

In case of windows dual boot with ubuntu, the windows bootloader and Ubuntu’s grub bootloader, both are stored in the EFI system partition which you can see is the topmost partition (/dev/nvme0n1p1). Don’t touch that, along with the windows partition (/dev/nvme0n1p2), and you are good to go.

Even if any boot issues arise, though they shouldn’t, you can follow this tutorial — https://linuxhint.com/ubuntu_boot_repair_tutorial/

One doubt that can arise : Why don’t we just shrink /home partition from the beginning of the space and then extend the / partition?

The reason is simple. If we shrink the /home partition, or in fact any partition from the beginning of the space, it can cause loss of data as data is stored at the starting of any partition.

Moving ahead,

Fig 9: Resize root partition

You can see unallocated space adjacent to the root partition (/dev/nvme0n1p6) in Fig 9.

Just click on root partition and expand the root partition to take up the adjacent unallocated space. We can see that new size of the root partition is ~121 GiB.

Fig 10: Swap on it again

IMPORTANT : After our operation is done, swap on the linux-swap again. This locks the partitions.

Step 5: Verify everything and click on apply operations

This is important! Many people make the mistake of closing GParted after swap on without applying operations. I myself did that too when I was using this for the first time.

But you won’t!

Fig 11: Verify all operations
Fig 12: Apply all operations
Fig 13: And you are done!
Fig 14: Final disk partitions

And… we are done!

Just restart the system and boot into your pre-installed Ubuntu after removing the installation media.

Step 6 : Check if the changes are applied on the main system

Open terminal on Ubuntu. Type these commands to check the space root and home partition take.

Fig 15 : Final disk space allocated

So, our work here is done! I hope you liked this article.

For any questions, feedback, or assistance, feel free to reach out. Enjoy your newly optimized Linux system!

--

--