I removed my Windows OS and now I want to resize my
/home partition with that unallocated space. The main problem is that the free space is not under my
sda4. How to move it there and then resize my
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 four operations. It may take some time for GParted to perform them.
/dev/sda3(the remaining NTFS partition) all the way to the left. This moves the unallocated space to be between
/dev/sda4(the extended partition, which contains your other partitions) all the way to the left (it will be flush against
/dev/sda3). This moves the unallocated space to be after
/dev/sda4, at the end of the disk.
/dev/sda4to the right, so it takes up all the available space (i.e., expand it to the maximum allowed size). This eliminates the unallocated space, but creates space inside the extended partition that no logical partition is using.
Inside the extended partition (i.e., inside
/dev/sda4), expand the logical partition
/dev/sda7(I assume that's your
/homepartition) to fill up all the available space on the right inside the extended partition. That is, expand
/dev/sda7to be as large as is allowed.
After you tell GParted you want those operations to be done, you have to tell it to apply them (click the green check mark). It may take a while, but it should work without problems.
Now no space is unallocated and the size of
/home partition) is increased by (almost exactly) the size taken up by the unallocated space when you started.
By the way, if you decide you want to decrease the size of the remaining NTFS partition (
/dev/sda3) to make more space for your installed Ubuntu system's
/home partition, you can shrink
/dev/sda3 (i.e., make it smaller on the right) between steps 1 and 2 above, or before step 1.
These changes shouldn't break the GRUB2 boot loader, and you should just be able to boot into your Ubuntu system afterwards. (Make sure to quit GParted and cleanly shut down / restart out of the live CD/DVD or live USB system.) However, in case there is a problem booting, you should be prepared to reinstall the GRUB2 boot loader to the Master Boot Record, to fix it. Fortunately, the same live CD/DVD or live USB system you use to run GParted can be used to reinstall GRUB2. See these methods. (You probably won't need to do this, though.)