Someone told me that there is a sub folder off of dev that basically allows you to tell the OS to keep the contents of that folder cached in RAM. So if I put some files & directories in /dev/somefolder the OS would keep this folder's content cached.

What folder is that? I'm on ubuntu 12.04, in case that matters.

  • "Cache" as disk cache? memory cache? – Braiam Aug 24 '14 at 1:02
  • @Braiam not totally sure. I think it means keep it in RAM – bernie2436 Aug 24 '14 at 1:05
  • Not in RAM but in virtual memory. If you have a swap area configured, that makes a big difference. – jlliagre Aug 25 '14 at 23:47

There is /dev/shm, which is a RAM-backed filesystem. This isn't the same as caching as a cache means the file also resides on disk. With /dev/shm, which is a tmpfs filesystem, the files exist in memory only.

Note that you can mount tmpfs volumes anywhere:

mount -t tmpfs none /foo/bar

There is just one usually mounted at /dev/shm.

  • Note that strictly speaking, tmpfs is not RAM-backed but Virtual-Memory-backed, i.e. the files blocks are stored either in RAM or on disk (in the swap area unless of course you have none). That gives tmpfs several advantages compared to traditional RAM disks implementations. – jlliagre Aug 25 '14 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.