OPNsense Forum

Archive => 15.1 Legacy Series => Topic started by: Davesworld on March 02, 2015, 11:41:51 pm

Title: Why formatted ramdisk instead of TMPFS?
Post by: Davesworld on March 02, 2015, 11:41:51 pm
I use flash devices as storage so I opted to put /var and /tmp in ramdisk. I was surprised when I recently installed PFSENSE and now Opensense that they end up using the old ramdisk filesystem which requires formatting. TMPFS is superior on several counts:

TMPFS requires no formatting, just mount it and give it a size if you wish but not required.

TMPFS can be resized and remounted on the fly with NO data loss.

TMPFS by default if no size is given, will size at 50% of system ram.

Any amount of Ram allocated by TMPFS but not yet used can still be used by the system as normal ram if need be.

If a swap file exists (the best swap is unused swap) TMPFS will use it as well if the need ever arises. 

TMPFS of course can have multiple mounts as the formatted ramdisk can, however, only the amount of actually used TMPFS mounts regardless of how large they are alloted for, deduct actual system ram. An example is that you have 1GB of ram, have three TMPFS mounts which no size is specified so all three default to 50% and are sized at 500MB each but only 20MB total is actually used by all three TMPFS mounts combined, the result is that full system ram minus that 20MB is still able to be used by the system.

Anytime you mount a ramdisk and format it with a filesystem, that amount of ram is completely unavailable and usable ONLY by that particular mount and it's gone for good until it is unmounted. If you resize ramdisk, you have to unmount it, resize it and reformat. TMPFS as I already mentioned can simple be re-mounted at a different size with NO data loss. This would come in handly if you specified a TMPFS size for a mount but it is too small, remount it at a larger size and go about your business. Even as unused TMPFS space is available to be used by the system's ram, a TMPFS mount can never exceed it's size.
Title: Re: Why formatted ramdisk instead of TMPFS?
Post by: franco on March 05, 2015, 06:20:51 pm
Hi there, we fork, we inherit the code. We clean up a lot, but there's always more. I'll push this in my backlog, but it has no immediate priority although it is very nice to have. Thank you. :)
Title: Re: Why formatted ramdisk instead of TMPFS?
Post by: Davesworld on March 05, 2015, 09:04:15 pm
Thanks and nice to be here!