I want to resize my primary partition using Gparted, but due to the lock I am not able to do so:
I would be grateful if someone tells me how to get rid of the lock so that I can resize this partition.
Best Answer
The reason why it does not work is that the sda1 partition is 'mounted'. It is accessed by some software and kept in RAM memory for various reasons. It's just like in Windows when some file is being blocked from deletion while accessed/opened by some software. You need to 'unmount' that partition in order to edit it in GParted.
This cannot be done from within a running system, you will have to (create and) use a GParted or Ubuntu LiveCD/LiveDVD/LiveUSB. Insert the live medium into PC and boot to the desktop. At this point, all partitions on the internal disk should be unmounted, thus unlocked. Open GParted and edit them as you desire.
Note : When doing it from an Ubuntu Live media, right-click the swap partition - select swapoff.
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.
Best Answer
The reason why it does not work is that the
sda1
partition is 'mounted'. It is accessed by some software and kept in RAM memory for various reasons. It's just like in Windows when some file is being blocked from deletion while accessed/opened by some software. You need to 'unmount' that partition in order to edit it in GParted.This cannot be done from within a running system, you will have to (create and) use a GParted or Ubuntu LiveCD/LiveDVD/LiveUSB. Insert the live medium into PC and boot to the desktop. At this point, all partitions on the internal disk should be unmounted, thus unlocked. Open GParted and edit them as you desire.
Note : When doing it from an Ubuntu Live media, right-click the swap partition - select
swapoff
.