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

On Windows you can use virtual memory to use disk space as RAM. Can you do this on Ubuntu?

share|improve this question
This question is rather vague. What do you want to achieve? A RAM disk? Limiting users' memory usage? – Lekensteyn Mar 7 '12 at 19:01
Yes, you can create a swap file/partition. – RobinJ Mar 7 '12 at 19:05
are you referring to the very slow vRAM? I think that's the same as SWAP... – Alvar Mar 7 '12 at 19:05
Im not quite sure, but on my windows pc i have created virtual memory. I want to know if you can do it on Ubuntu. – Will Mar 7 '12 at 19:09

As RobinJ said before, you are looking for a Swap-Partition. Linux usually does not make use of virtual memory in a file, like windows does, but needs it on its own partition. Swap is used for suspend to disk, since this command will copy the ram into the swap space.

To find out if you already have a swap partition, type

swapon -s

into a terminal. it will list all swap partitions.

Swap files are also possible but do rarely exist. For a guide, see

For a guide of how to add swap space, please refer to Adding swap partition after system installation But attention! The mkswap command formats the partition which cannot easily and often not at all be restored.

Generally, swap is less useful (but still used!) since bigger RAM is affordable (except for suspend to disk). Some sources say the swap space should be as big as the RAM and a maximum of twice as big as RAM. For suspend to disk, swap space should be RAM size plus 30%.

share|improve this answer

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.