Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: ability to limit tmpfs for var and tmp #2856

Closed
soder10 opened this issue Oct 27, 2018 · 11 comments
Closed

Feature request: ability to limit tmpfs for var and tmp #2856

soder10 opened this issue Oct 27, 2018 · 11 comments
Labels
support Community support

Comments

@soder10
Copy link

soder10 commented Oct 27, 2018

Hello devs,

I have enabled tmpfs for /var and /tmp to spare the SSD. However, I would like to make sure the available RAM is not decreased down to 0 due to a runaway logging process or tmp pollution. It would make sense to limit the size of the tmpfs filesystems to 50% or 75% of RAM. With that it can guarantee the availability of the system even if the tmpfs fills up.

@soder10
Copy link
Author

soder10 commented Oct 29, 2018

Checking freebsd man for tmpfs:
https://www.freebsd.org/cgi/man.cgi?query=tmpfs&apropos=0&sektion=5&manpath=FreeBSD+11.2-RELEASE+and+Ports&arch=default&format=html

The following options are available when mounting tmpfs file systems:

size Specifies the total file system size in bytes, unless
suffixed with one of k, m, g, t, or p, which denote
byte, kilobyte, megabyte, gigabyte, terabyte and
petabyte respectively. If zero (the default) or a
value larger than SIZE_MAX - PAGE_SIZE is given, the
available amount of memory (including main memory and
swap space) will be used.

@fichtner fichtner added the support Community support label Oct 29, 2018
@fichtner
Copy link
Member

fichtner commented Oct 29, 2018

Hi,

This brings us back to the old days where tmpfs was not being used and the memory disk would always need an upper bound. There is little to no desire to move back into this direction.

I understand the motivation, but don't think trading one issue for another is worth it.

You can always use tmpfs manually via /etc/fstab. It should work fine if you disable the GUI option first.

Cheers,
Franco

@soder10
Copy link
Author

soder10 commented Oct 29, 2018

If I disable the GUI settings, do I need to reboot in order to active the change? Then I should break the normal boot process, and boot into single user mode, edit fstab to add the 2x tmpfs with -o size xxxx, and only then let the multiuser boot finish?
Should the GUI code check for existing entries for /var and /tmp if by accident I re-enable the setting while this manual workaround is still active?

@fichtner
Copy link
Member

You need to reboot, but you can disable the GUI setting, edit /etc/fstab and reboot in one go. /tmp tmpfs should be there with no further modification. The memstick image uses tmpfs directly, so you can compare:

https://github.com/opnsense/tools/blob/master/build/vga.sh#L52

@fichtner
Copy link
Member

(options are passed along with rw,mode=01777,size=xxxx)

@soder10
Copy link
Author

soder10 commented Oct 30, 2018

Ok, I will try it. Just in case the help for this ramdisk can add this little info about no size limit?

@fichtner
Copy link
Member

I don't know. Between adding the hint and losing the translations for the current help text there is no clear winner...

@soder10
Copy link
Author

soder10 commented Oct 30, 2018

I let you guys think about this. Documentation could give 1-2 lines about this.

@fichtner
Copy link
Member

Hi @soder10,

After removal of a backwards compatibility code with versions < 17.1 and a bit of thought it doesn't need any more info in the GUI itself, but I'm not opposed descriptions in the documentation, although we don't have a relevant page with that particular area (misc settings) at the moment.

As far as I remember this is the only time this has been asked in years, compared to when people asked for memory disk to be moved to tmpfs to tap RAM in an unlimited fashion.

Cheers,
Franco

@soder10
Copy link
Author

soder10 commented Nov 12, 2018

Ok, thanks for the support anyway.

@paulofragoso
Copy link

Could there be an option in System: Settings: Tunables to set optional max tmpfs size?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Community support
Development

No branches or pull requests

3 participants