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 am trying to increase the swapfile size on my WUBI install.

I followed the answer here:

    sudo su

    swapoff -a

    cd /host/ubuntu/disks/

    mv swap.disk swap.disk.bak

    dd if=/dev/zero of=swap.disk bs=1024 count=2097152

    mkswap swap.disk

    swapon -a

    free -m

until I reached:

    mv swap.disk swap.disk.bak

At which point I have got got the following:

    root@ubuntu:/host/ubuntu/disks# mv swap.disk swap.disk.bak

    mv: cannot move `swap.disk' to `swap.disk.bak': Operation not permitted

My 256 M swap space is all used up. I would like to install a total of twice that. Is there a method of setting it which would not include guesswork on my part?

I followed BCBC below and now I get an error:

    swapon -a

    swapon: /host/ubuntu/disks/swap.disk: read swap header failed: Invalid argument –

/etc/fstab looks like:


/host/ubuntu/disks/swap.disk none swap sw 0 0


(Have to be sure to allow all processes to finish; this takes several minutes.)


share|improve this question
up vote 1 down vote accepted

It should allow you to mv once you've turned off swap (swapoff -a). That should have worked...

Instead, create the new swap disk under a different name e.g. newswap.disk and boot back to Windows before doing the rename/move.

PS you might want to run chkdsk on that Windows drive as well. Just in case. File system corruption does occur on Wubi installs, and sometimes a symptom like not being able to rename a file might be an indicator. (Although this time it's probably that the swap wasn't turned off).

So you would run:

sudo su
cd /host/ubuntu/disks/
dd if=/dev/zero of=newswap.disk bs=1024 count=2097152
mkswap newswap.disk

Then reboot to Windows and replace swap.disk with newswap.disk. (But first try the original instructions again and make sure you've run swapoff -a and it completed without errors.)

PS you can see if the swap file is still mounted with:

swapon -s
share|improve this answer
swapon: /host/ubuntu/disks/swap.disk: read swap header failed: Invalid argument – Diogenes Lantern Nov 11 '13 at 0:42
Is that after you created the new swap file? Did you forget to run mkswap? – bcbc Nov 11 '13 at 1:49
That got it, I forgot mkswap! One more question. I started the code with sudo sudo su, as I had the "operation not permitted" problem before, when I started with sudo su. Does it make a difference? – Diogenes Lantern Nov 11 '13 at 17:50
@DiogenesLantern When I use more than one sudo e.g. sudo sudo su it ignores the extras. It should be identical to sudo su. Not sure why it didn't work for you. Maybe a typo? Try it again and see what happens. – bcbc Nov 12 '13 at 3:12
yes they're the same - using "sudo sudo sudo sudo su" = "sudo su". – Diogenes Lantern Nov 13 '13 at 0:28

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.