Increase an ext4 partition with Gparted

In this post, I explain how to resize and increase the size of an ext4 partition in a Linux Machine.

I need to increase the size of an ext4 partition in a Linux Virtual Machine (VirtualBox).

First I have assigned more disk space to this virtual machine. You can see how to make it in the post “How to resize a virtual machine’s disk in VirtualBox“.

I have stopped (shut down) the machine.

Then I have made a VM backup (copy or zip the VM files). If you are making this operation in a hardware system I recommend to create a whole disk or partition image backup. You have a lot of free software to do this: I usually use Clonezilla.

Then I have downloaded the GParted Live CD (ISO file).

increase-a-ext4-partition-with-gparted-01

Then I have added the ISO image to the optical unit in the virtual machine so I can start the VM with this live CD.

increase-a-ext4-partition-with-gparted-02

Start the VM and select the “Gparted Live (Default settings)” mode. I start the Live CD with the default settings.

increase-a-ext4-partition-with-gparted-03

I have:

  • one primary partition (/dev/sda1) with 19.14 GB. This is the partition that I want to increase.
  • One extended partition (/dev/sda2) with one linux-swap partition (/dev/sda5): 880 MB.
  • 20GB of unused space.

I have to put the 20GB of unused space right after the primary partition, so I can resize and increase the size of this partition.

I have to resize the extended partition.

increase-a-ext4-partition-with-gparted-04

increase-a-ext4-partition-with-gparted-05

I resize the partition from 880 MB to the maximum size: 21361 MB, using the drag bar.

increase-a-ext4-partition-with-gparted-06

Then I move the linux-swap partition to the end of the extended partition, using the drag bar.

increase-a-ext4-partition-with-gparted-07

increase-a-ext4-partition-with-gparted-08

increase-a-ext4-partition-with-gparted-09

increase-a-ext4-partition-with-gparted-10

Now I have to free the available space at the beginning of the extended partition using the drag tool.

increase-a-ext4-partition-with-gparted-11

increase-a-ext4-partition-with-gparted-12

increase-a-ext4-partition-with-gparted-13

Now I have the 20GB of unallocated space right after the primary partition, so I can resize and increase the size of this partition.

increase-a-ext4-partition-with-gparted-14

increase-a-ext4-partition-with-gparted-15

increase-a-ext4-partition-with-gparted-16

To finish, I have to “Apply” all the changes.

increase-a-ext4-partition-with-gparted-17

increase-a-ext4-partition-with-gparted-18increase-a-ext4-partition-with-gparted-19

increase-a-ext4-partition-with-gparted-20

Now I have to extract the GParted ISO image from the virtual optical device and restart the virtual machine.

2 comments

  1. This is well documented and was extremely helpful, at least in comparison to the solutions on StackOverflow and StackExchange […] Thank you!
    Minor suggestion: Perhaps explicitly state that the extraction at the end involves exiting from within the GParted LiveCD.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.