Ubuntu – Resize partitions | gparted | swapoff fail

gpartedpartitioning

I have installed ubuntu 12.04 alongside winxp on my laptop.
I'm trying to resize partitions (shrink winxp – enlarge ubuntu) running Gparted from LiveUSB. I read that I have to swapoff the linux-swap in order to resize the ubuntu partition.
However, when I try to swapoff I get the error:

Could not deactivate swap
swapoff: /dev/sda6: swapoff failed: Cannot allocate memory

I don't know how to proceed from here.
(note: linux newbie)

Update:
I somehow managed to swapoff linux-swap so there is now no partition with a lock icon. Didn't do anything different, it just happenned. Still, after shrinking my winxp partition, gparted won't let me drag the ubuntu partition to the left (where the newly created unallocated part is) to resize it:

WinXp partition | unallocated | ubuntu | linux-swap


*Note: I understand that by dragging the left handle and should the whole thing succeed, there will probably be a problem with the grub 2 boot screen. I have also come to understand that this can be easily fixed with some terminal commands via the liveUSB. Please correct me if I'm wrong.

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.

Related Question