This is similar to this question, except that there, space outside of an extended partition was moved into an extended partition, and then used by a logical partition (in the extended). In this question, space inside an extended partition needs to be moved out of the extended partition, and used by a primary partition. While the situations are different, I've based this answer on my answer to that question.
First, make sure that:
All your documents and other important (i.e., hard to replace) files from all your partitions are backed up. Moving and resizing partitions dynamically carries with it a small risk of data loss (for example, if there is a power failure, if one of your filesystems is broken in a way GParted does not know how to detect, or if there is a bug in GParted), plus you could make a mistake and accidentally wipe something out.
You are running from a live CD/DVD or USB flash drive, rather than running GParted out of the installed Ubuntu system. It is unsafe (and would almost certainly not succeed) to dynamically move and resize partitions on the same physical disk as the OS you use to do it.
Provided that this is taken care of, you have to perform 4 (or 5) operations. It will definitely take a while for GParted to perform them.
Shrink /dev/sda7
(/
) down to whatever size you like. Remember to leave some space, because you need to have some free space on /
for Ubuntu to update and install software, store non-user-specific files (including global configuration files), keep system logs, and so that applications can store data in /var
and /tmp
.
- I recommend shrinking this on the left (i.e., increasing Free space preceding). However, if you are insistent on attempting to reclaim the 3 MiB of space between the end of
/dev/sda7
(/
) and /dev/sda5
(your swap partition), then you might as well instead shrink it on the right (increasing Free space following), then move the partition to the right. Please note that performing these two separate operations will make things take longer, and is almost certainly not worth it if your goal is to maximize available space. On the other hand, if the issue is that you're personally bugged by an ugly partition table, go ahead. ;-)
This step creates unallocated space in the extended partition, between /dev/sda6
(/home
) and /dev/sda7
(/
).
Move /dev/sda6
(/home
) as far to the right as it will go, inside the extended partition. This moves the unallocated space to the very beginning (i.e., left side) of the extended partition.
Shrink /dev/sda4
(the extended partition) on the left (increasing the Free space preceding). When I tried this to make sure it would work properly, I found that it did, but that I had to manually specify a different Free space preceding number. Once I supplied any number manually, I was then able to shrink my extended partition easily by dragging its left edge to the right (as you'd expect to be able to do from the get-go). I'm not sure if you will experience this issue, but if you do, you can use that workaround.
This step moves the unallocated space out of the the extended partition.
Expand /dev/sda3
(/windows-d
) on the right as much as possible (decreasing Free space following), so that its right edge is flush with (or as close as possible to) the left edge of /dev/sda4
(the extended partition you've just shrunk down).
This step moves eliminates the unallocated space, converting it into free space inside your /dev/sda3
Windows partition.
You must apply your changes to get GParted to perform the operations. To do this, click the green check-mark. After the operations complete, make sure your partition layout looks the way you want it, and quit GParted.
Since you have no separate /boot
partition, the boot files for your Ubuntu system are located in the /
partition (/dev/sda7
). Since you have changed where this partition starts (i.e., the location of its left edge), and where the extended partition that contains it starts, it's likely that your Ubuntu system will not be able to boot. Fortunately, fixing this is easy, and consists of reinstalling GRUB2 (your boot loader) to your Master Boot Record.
If you want to try shutting down / restarting the live CD/DVD/USB system and booting into your Ubuntu system at this point, you can, but it's likely enough that you'll have to reinstall GRUB2 to the MBR that I recommend just doing it before rebooting. You can use any of the methods presented here.
Since you'll probably have to do this, I'll detail one method in this answer (with specifics of your system filled in). In the live CD/DVD/USB system, open a Terminal window (Ctrl+Alt+T) and run these commands:
sudo mount /dev/sda7 /mnt
sudo grub-install --boot-directory=/mnt/boot /dev/sda
sudo umount /mnt
Then reboot into the Ubuntu system installed on the hard disk, to make sure everything is working. It's also a good idea to boot into the Windows, and make sure it recognizes the NTFS partition. If Windows wants to perform a chkdsk
scan and fix problems, you should let it.
Best Answer
The message indicates that your are running low of memory. The current need is only satisfied with enabled swap space.
Most likely is that you loaded the LiveUSB content into ram at boot time. Check the boot menu and deselect this option.
Some further remarks
As I see in your question, the swap space is not inside the partition you want to resize. So with a little bit luck you haven't the need to disable the swap space. Give it a try.
Generally I would consider to use LVM instead of bare partitions. The "space management" is a lot easier and you can do it online without LiveUSB :-)
You can increase a partition if you have enough free space allocated for the LVM volume group. If you run low of space in a volume group you can simply add a new physical volume to the volume group. So you work around the problem that you have to repartition your disk.