Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

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.

share|improve this question
Consider that dragging the left handle will move all your Ubuntu data which takes long time dependent on the volume and has the risk of data loss – of course I’ve done it for two times before and I was successful. – AliNa Mar 5 '13 at 2:46
Thanks for this input. So is it possible (and quite safe) to reorder partitions so I can move the unallocated space to the right of ubuntu? – MorganSBailey Mar 5 '13 at 12:22
Unfortunately no. If you don’t need to move the partition, give it up. But if you need to, free as much space as possible in Ubuntu partition to reduce moving time, then move the partition. As I remember it will take about 1-1.5 hours to move for every 20 GiB of data. – AliNa Mar 5 '13 at 15:12

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.

share|improve this answer
Thanks a lot. I think I'll try to work out the boot thing, since the LVM sounds like too much to meddle with right now, for a non-techie guy like me. – MorganSBailey Mar 5 '13 at 0:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.