GParted merge unallocated space to ext4 partition [duplicate]

The steps:

  1. Start GParted in live Ubuntu session,

  2. Unmount (if it's mounted) the partition that will be involved in the resize/move operation, here /dev/sda2 (by right clicking and selecting unmount from the context menu),

  3. Now right click your /dev/sda2 partition and select Resize/Move option, and drag the slider right to cover the entire unallocated space. And then click the Resize/Move button, snap1

  4. After specifying the resize options, from the menu select Edit -> Apply All Operations or click the Apply button in the toolbar. Wait patiently for the operation to complete.


You can boot from Ubuntu's LiveCD and use GParted on it or download GParted's LiveCD .iso, burn it to a CD and boot into it. The key icon beside a partition means that said partition is mounted and thus cannot be modified. Booting to a LiveCD should resolve this issue. If it does not, use umount to unmount a partition.

Since the unallocated space is to the left of the ext4 partition you wish to resize, you'll first need to move the partition to the left of the unallocated space, which might cause boot error. Follow GParted's instructions on moving partitions.

Then right-click on the ext4 partition and select "resize". Expanding it will shrink the unallocated space and expand the partition's free space. Leave 5GB unallocated and use it to create a swap area.