My scenario:

I have a server with 256GB of ram and I want to create a ram disk, with let's say a 224GB size. Now, I know that there are two main types for ramdisk - ramfs & tmpfs (taken from here):

  1. ramfs file systems cannot be limited in size like a disk base file system which is limited by it’s capacity. ramfs will continue using memory storage until the system runs out of RAM .

  2. tmpfs is a more recent RAM file system - You can specify a size limit in tmpfs which will give a ‘disk full’ error when the limit is reached.

As it seems, tmpfs is the way to go. But after creating the ramdisk using:

>  mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk

I noticed that 224GB ram is not actually guaranteed for the ramdisk (free -g gives 256GB free memory without cache)

So, from what I understand tmpfs gives a "barrier" for maximum ram to be used (224GB in my case), but it doesn't guarantee that memory for the ramdisk.

My Question:

How do I prevent other applications from accessing my ram (the 224GB portion). I don't want a get to a scenario where instead of saving to my ramdisk, I am saving to swap.

=========== Update =============

I found this . It looks a bit "old school", but it could be a solution to my problem.

  • A tmpfs filesystem only uses as much memory as required (currently in use)...Those you could create a loopback file with the needed size inside the tmpfs! – marc Jan 19 '17 at 12:41

Your Answer

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

Browse other questions tagged or ask your own question.