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'd like to make sure that the memory allocated for a RAM disk never gets paged to a HDD. How can it be done in Ubuntu?

share|improve this question
Why would you want to do this? It will likely degrade your overall performance. Modern memory managers are very good about not paging out used memory. Used memory would include any actively used space allocated to the RAM disk, but exclude unallocated space on the RAM disk. – BillThor Aug 26 '12 at 18:45

There are two types of filesystem commonly used for RAM-disks in Linux, ramfs and tmpfs.

tmpfs is the more modern on the two, and will put unneeded files in swap. As far as I am aware, there is no option to disable this.

ramfs is older and more primitive, and cannot use swap. Be warned, however, that unlike tmpfs a ramfs filesystem will continue to grow until you are out of RAM, at which point your system will hard-freeze. Therefore, if you use ramfs, you must be vigilant of its size at all times.

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.