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 added the ISO image to the optical unit in the virtual machine so I can start the VM with this live CD.
Start the VM and select the “Gparted Live (Default settings)” mode. I start the Live CD with the default settings.
- 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.
I resize the partition from 880 MB to the maximum size: 21361 MB, using the drag bar.
Then I move the linux-swap partition to the end of the extended partition, using the drag bar.
Now I have to free the available space at the beginning of the extended partition using the drag tool.
Now I have the 20GB of unallocated space right after the primary partition, so I can resize and increase the size of this partition.
To finish, I have to “Apply” all the changes.
Now I have to extract the GParted ISO image from the virtual optical device and restart the virtual machine.