Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 want a ramdisk on linux.

There is ramfs and tmpfs.

Tmpfs is what I want because it acts like a disk (size limits, etc.). However, it uses swap which means it may touch disk if it gets full.

IF I don't have swap turned on, will it still work?

I don't want that mount to touch disk at all.

share|improve this question
up vote 4 down vote accepted

Tmpfs will still work without swap, since it just uses the normal Linux memory allocator. Do not worry, it won't create swap for you out of nothing just because it doesn't have it.

share|improve this answer
i suspected as much, but I wanted to hear from someone who actually did it. we'll verify it in house. – drudru Nov 8 '11 at 22:44
However, if swap is on, it will possibly use it. I need something else. – drudru Aug 11 '13 at 22:29

You can use ramfs which is similar to tmpfs but should never touch disk. I'd still recommend tmpfs because it has more features and:

  • If you have no swap partition or swap file, neither will touch the disk.
  • If you have a swap partition data on tmpfs will not touch the disk, but a process reading or writing that data could be swapped to disk.
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.