Step 0: Backup your data
Make sure you have up to date and good backup of all your personal files. The backup must be outside your computer. If you haven't backed up your data, stop now and make backup.
Step 1: Boot from a LiveCD/DVD/USB
You have done this. I am writing it for anyone who may read this later. This is important, as you can't change a tire of a car while you are driving it.
Step 2: Disable Swap
Open a terminal by pressing Ctrl+Alt+T, or click on the Terminal icon of live CD desktop
sudo swapoff -a
Step 3: Delete Swap partition
Make sure the swap partition is unmounted. Right click on the Swap partition from within Gparted, and click on Unmount.
Now you should be able to delete swap partition. It is the logical partition
/dev/sda5 inside the extended partition
Step 4: Delete Extended Partition
The extended partition can't be deleted until the logical partition inside it is deleted. We did that in step 3. Now we can delete
Step 5: Delete
You can delete this partition as it has no data. Then you will use most of this space to resize the
Step 6: Resize sda1
Use Gparted to expand
/dev/sda1. Leave 8GB space (or less if you want) at the end to recreate the swap partition.
#Step 7: Create a new swap partition
You can choose to create a primary partition (new
/dev/sda2) for swap. Since you are going to have only two partitions in this drive, there is no need for an extended partition.
Step 8: Find the new UUID of the two partitions
In Gparted: Right click on a partition and select "Information"
In terminal enter:
And write down (or copy to a text editor) the two UUIDs for sda1 (
/ partition) and sda2 (swap).
Step 9: Edit
Mount the main partition, i.e.
sudo mkdir /mnt/mount_sda1
sudo mount /dev/sda1 /mnt/mount_sda1
and navigate to
Find the file called
fstab. Copy the new UUID in their appropriate places if needed.
If there is any lines related to the old
/dev/sda3, you should delete that. As that partition does not exist any more.
Hope this helps
Extended partitions are like containers for logical volumes. But unfortunately, you can't just move the whole container.
Maybe it helps if you imagine partitions as cardboard boxes. A primary partition is a standard box and logical volumes are like little boxes that have to stay inside an extended partition. Now the interesting thing is how the extended partition would look like as box: It would be a box without a bottom!
It covers the small logical volumes, so to the outside (e.g. to the MBR partition table which only allows 4 partitions per disk) just looks like one big box, but if you would try to move it and lift it off the floor, all those little boxes inside (logical volumes) would still sit on the same place on the ground. You understand what I want to illustrate to you? By moving an extended partition (which does not work for that reason), you don't move the contained logical volumes.
So the solution to move an extended partition is to first enlarge the extended partition by moving one boundary to cover all the new space it should be moved to, then move all contained volumes to their respective new position, then shrink it again by moving the other boundary so that there's no unassigned space left inside the extended partition.
You don't have to, but...
Although having the Swap partition at the end might not affect performance, it might let you modify the other partitions (enlarge/reduce etc.) more easily later without touching your Swap again.
And to do this in GParted: