I cannot extend my partition into unallocated space [duplicate]

I have a dual booted Windows with Ubuntu. I want to extend my Storage of /dev/nvme0n1p5 (my Ubuntu partition) into the unallocated space with GParted. I cannot seem to be able to extend into the empty space ( I also tried from Windows Disk Management)

Screenshot of GParted


Solution 1:

The key icons beside 2 of your partitions indicates that they're "locked". Notice that they're mounted (on / and /boot/efi).

To avoid destroying the partition table of the /dev/nvme0n1 "disk", you cannot edit the partition table while any of its partitions is mounted.

To edit the partition table, boot a Live USB and run gparted from there . You cam easily find a Gparted Live USB on the internet.

If your disk is MBR, rather than GPT, you might have to shrink the primary partition (shrink /dev/nvme0n1p4 first).