philotux wrote: ⤴Tue Jan 22, 2019 8:08 pm
So, mount.tmp is not to be considered like an "ordinary" service which can be enabled and started with --now or later on with start. Once /tmp gets mounted at /tmpfs, it is activated at the same time.
It would be interesting to know if there are other directories that can safely be put on /tmpfs. I understand that one should never put /var/tmp on /tmpfs since it's content must survive a reboot.
hi philotux!
as I understand it the file tmp.mount is a set of instruction to OS on how to create a 'virtual disk/partition' formatted as tmpfs and can be used to as mount point for anything pointed at it. and yes, once /tmp gets mounted in this tmpfs virtual partition (in RAM) it is active immediately (as systemctl reload occurs as mentioned by WharfRat and in man systemctl)
To recap what I believe is going on now is I have a dynamically managed tempfs "partition" mounted /tmp directory that may expand to use up to 3.9GB of system RAM and basically flushes clean each restart (I imagine on logoff as well
I feel this is superior to the suggested method, set a static size RAM drive to mount through fstab, as it allows the system to use exactly what is needed, when its needed, instead and not a static size that dedicates a chunk of system RAM that may or may not be used in any significant amount.
Not really anything to solve here, so leaving convo open as such for others that may weigh in with other methods and ideas as philotux mused what else is safe/good idea to direct towards tempfs. (See also Arch wiki link and quote below)
For clarity I have the following questions.
Is tempfs as my results below suggest, limited to a max size of 3.9GB? found a good
Arch Linux page on tempfs that confirms tempfs default size is half RAM.
still curious, What happens when system reaches that limit? DE or system crashes is the concern, especially if taxing system memory hard at the time tempfs wants to expand for /tmp storing use
some really good info on what may be good to point at tempfs, from Arch wiki linked above:
Usage
Some directories where tmpfs(5) is commonly used are /tmp, /var/lock and /var/run. Do not use it on /var/tmp, because that folder is meant for temporary files that are preserved across reboots.
Arch uses a tmpfs /run directory, with /var/run and /var/lock simply existing as symlinks for compatibility. It is also used for /tmp by the default systemd setup and does not require an entry in fstab unless a specific configuration is needed.
glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for POSIX shared memory. Mounting tmpfs at /dev/shm is handled automatically by systemd and manual configuration in fstab is not necessary.
Generally, tasks and programs that run frequent read/write operations can benefit from using a tmpfs folder. Some applications can even receive a substantial gain by offloading some (or all) of their data onto the shared memory. For example, relocating the Firefox profile into RAM shows a significant improvement in performance.
Note: The actual memory/swap consumption depends on how much is used, as tmpfs partitions do not consume any memory until it is actually needed.
my first thought here is definitely want to get Firefox using tempfs, but load (entire) profile?
perhaps better to point cache at tempfs? otherwise what happens to profile changes on reboot... is profile loaded into memory for duration of session, then closing browser writes any changes back to profile on disk (in FF default location) before dumping memory effectively wiping everything stored in tempfs?
more startpage-ninja search/research needed, and all related comments for sure still welcome!
----
otherwise, happy to report, after installing some updates this morning then reboot, all looks good
Code: Select all
anyuser@f023:~$ systemctl status tmp.mount
● tmp.mount - Temporary Directory (/tmp)
Loaded: loaded (/etc/systemd/system/tmp.mount; enabled; vendor preset: enabled)
Active: active (mounted) since Wed 2019-01-23 07:25:01 MST; 38min ago
Where: /tmp
What: tmpfs
Docs: man:hier(7)
https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
Process: 616 ExecMount=/bin/mount tmpfs /tmp -t tmpfs -o mode=1777,strictatime,nosuid,nodev (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 4915)
CGroup: /system.slice/tmp.mount
Jan 23 07:25:01 f023 systemd[1]: Mounting Temporary Directory (/tmp)...
Jan 23 07:25:01 f023 systemd[1]: Mounted Temporary Directory (/tmp).
anyuser@f023:~$ sudo du -sh /tmp
56K /tmp
anyuser@f023:~$ df -h /tmp
Filesystem Size Used Avail Use% Mounted on
tmpfs 3.9G 56K 3.9G 1% /tmp
anyuser@f023:~$