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 using the Wubi installer. So I have the default swap size of only 256MB. I have 1GB of RAM, so many times the system stars crying demanding more swap. I have read the Swap FAQ, but I'm still not sure about how to increase swap size when Ubuntu is installed using Wubi.

share|improve this question

Just follow the Wubi Guide. While some of the other answers may work, you must make sure you don't create the swap file on the loop mounted device, which may see decrease in performance.


How do I increase my swap space?

The following will increase your swap to 2 GB. Replace count= with the number of kilobytes you want for your swap file.

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
share|improve this answer

I've never used Wubi before, but I'm guessing that adding partitions might be complicated. However, there's no rule that says that you need to use a swap partition. You can use a swap file, as well, and store it anywhere you like on the system. I'd likely choose /media, but it's up to you. Here's how:

  1. Create your extra swap file and set the appropriate permissions. You can put it anywhere you like. Set the size equal to how much additional swap space you want.

    sudo fallocate -l 1g /path/to/desired/file
    sudo chmod 600 /path/to/desired/file
  2. Format your swap file:

    sudo mkswap /path/to/desired/file
  3. Add it to /etc/fstab:

    gksudo gedit /etc/fstab

    Insert this at the bottom of the file:

    /path/to/swap/file  none  swap  sw  0 0
  4. Enable all swap, including your new swap file:

    sudo swapon -a

I took much of my answer from the Swap FAQ. Scroll down to the part that talks about swap files.

share|improve this answer

I think that here they explain how you can do that in a easy way. I don't know how exactly wubi works so I'm guessing you want to add a file as a swap. If you are using a partition then you'll need to use something like parted to resize your disk partitions.

share|improve this answer
Whilst this may answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference - that way, if the original link ever dies, we don't end up with link rot, we still have the information. – Caesium Dec 18 '11 at 11:18

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.