There are a number of possible solutions, but the one I recommend is as follows:
- Back up all your important data. Partition moving and resizing operations are inherently dangerous, so things occasionally go wrong when performing steps like the following. Having a backup ensures you won't lose irreplaceable data.
- Boot a Linux emergency disc, such as Parted Magic or the Ubuntu installer in its "try before installing" mode.
- Launch GParted.
- Using GParted, shrink /dev/sda1.
- Using GParted, delete both swap (/dev/sda5) and the extended partition that holds it (presumably /dev/sda4).
- Optionally, using GParted, expand /dev/sda3 into the space freed by the previous step. Alternatively, you can just leave blank space there.
- Create a new extended partition in the blank space left by step #4.
- Create a new swap partition inside the extended partition.
- Create new partition(s) for Linux Mint inside the extended partition. Alternatively, you could leave this to the Mint installer.
The result will be a legal, if somewhat odd, partition table. One drawback is that this procedure leaves your Windows installation the same size as or bigger than it is now. If you wanted to use some of the Windows space for Mint, you'd need to shrink and move the partition, which is the riskiest type of partitioning operation. It's also likely to leave Windows unbootable until repaired. Overall, it's best to avoid this if possible -- and given your stated goals, it seems to be possible to avoid it.
In theory, both Ubuntu and Windows should remain bootable after this procedure; however, it's conceivable that one or both OSes might be rendered unbootable. If so, you'll need to repair bootability with an emergency system. The details of how to do this depend on the details of the problem, so I won't address those details here; I just want you to be aware that there's a small but real risk of this happening, and that the problem can be overcome if you encounter it.
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 /dev/sda2
.
Step 4: Delete Extended Partition /dev/sda2
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 /dev/sda2
.
Step 5: Delete /dev/sda3
You can delete this partition as it has no data. Then you will use most of this space to resize the /dev/sda1
.
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
Either
In Gparted: Right click on a partition and select "Information"
Or
In terminal enter:
sudo blkid
And write down (or copy to a text editor) the two UUIDs for sda1 (/
partition) and sda2 (swap).
Step 9: Edit /etc/fstab
Mount the main partition, i.e.
sudo mkdir /mnt/mount_sda1
sudo mount /dev/sda1 /mnt/mount_sda1
and navigate to /mnt/mount_sda1/etc/
folder.
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
Best Answer
You can't move the partitions that are mounted (the ones with the key icon), and you can't unmount the system you are running. You can unmount the swap drive, but that's not enough. So, you need to boot Linux from a cd or usb drive, then run gparted. The original Ubuntu disk will work, just don't install, but use the feature to try it out without making changes (ie, live CD).
Once you run gparted from another disk, you will want to resize sda3, the container for the logical drives, by selecting resize, and dragging it all the way to the left. Then, do the same for sda5, so it fills the partition. Finally, click the chekbox icon to apply the changes, and be prepared to wait a few hours, as resizing the partition to the left requires moving all the data. If you had left space at the end, then it would have been much quicker to resize to the right.
Make sure you do not turn off the power while this is happening. A power outage could be disastrous, so if you have a desktop, a UPS is a good thing to have. If you were to have a power outage, you might be able to cancel the operation.
If you have a laptop, make sure the battery is charged, and leave it plugged in.