Where else can tmpfs be mounted besides /tmp?

/var/run is an example of something that doesn't have to survive reboots. Just make sure startup creates all the required directories in there.
 
Google AI,
Yes, you can safely remove
~/.cache (user cache) or clear system cache directories (e.g., /var/cache/pkg) in FreeBSD to free up space. The files will be automatically recreated when needed, though this may initially slow down some applications.

Safe Cleanup Commands:

  • Clean Package Cache: Run pkg clean -a to remove downloaded package files from /var/cache/pkg/.
  • Remove Old Packages: Run pkg autoremove to remove unused dependencies.
  • Clear Port Build Files: Run make clean within /usr/ports/ to remove temporary build files.
  • Remove User Cache: You can safely delete the ~/.cache directory in your home directory, as it only contains local application data.
  • System Upgrades: Safe to clean up /var/db/freebsd-update/ files after an upgrade
 
Please don't post AI slop.

~//.cache can contain data that, yes, is automatically re-created. But it can be very expensive, for example local LLMs can be stored there and you would have to re-download 100 GB per model. You don't want to do that after every reboot.
 
So tmpfs is basically a memory based filesystem, so anything that does not need to survive a reboot (like /tmp, /var/run) would be fair game as long as you have enough memory.

The "enough memory" kind of goes with cracauer@ example of LLMs and 100G of data. That would be an interesting (in a probably doomed to failure way) experiment on a 64GB RAM system; maybe you could do it if you had 1TB of swap.
But why would you want to?

Other potential uses are filesystems not needed to survive reboot but need speed. I've seen uses as a place to download packages, so maybe as the space used when you do "pkg install". In theory it should speed up the download because you are going from network interface to ram to ram instead of network to ram to physical device

Build artifacts are another good use, but one has to weigh the overall system because tmpfs uses memory and again "do I have enough RAM to support the usage".

I think a lot of arguments can be made for and against some uses. I can see an embedded device maybe using a tmpfs for a lot of things that get reloaded during boot; kind of like a security thing. Running a VM is akin to using a tmpfs that gets reloaded from a binary image everytime.

The above is human generated, based solely on my personal experience and is not intended as a course of action, but rather, give you food for thought (which never seems to satisfy hunger).
 
Please don't post AI slop.

~//.cache can contain data that, yes, is automatically re-created. But it can be very expensive, for example local LLMs can be stored there and you would have to re-download 100 GB per model. You don't want to do that after every reboot.
Sorry i run ollama , and it's in /home/userdir/.ollama. Name me one stuff/model which stores in /home/userdir/.cache, ... i cannot. For me .cache is to throw away unless viable proof.
 
My current fstab,
Code:
/dev/nda0p1          none                swap        sw                              0   0
/dev/ada0p1          /                   ufs         rw                              1   1
proc                 /proc               procfs      rw                              0   0
fdesc                /dev/fd             fdescfs     rw                              0   0
SSD/usr              /usr                zfs         rw                              0   0
/dev/ada3p1          /mnt/ada3p1         ufs         rw                              2   2
tmpfs                /tmp                tmpfs       rw,mode=1777,size=2G            0   0
tmpfs                /var/tmp            tmpfs       rw,mode=1777,size=1G            0   0
tmpfs                /home/x/.cache      tmpfs       rw,mode=0700,uid=1001,size=4G   0   0

mount -v | grep tmpfs
Code:
tmpfs on /tmp (tmpfs, local, vnodes: count 19 )
tmpfs on /var/tmp (tmpfs, local, vnodes: count 9 )
tmpfs on /SSD/home/x/.cache (tmpfs, local, vnodes: count 18 )
 
Hmm. lets see. My system under $HOME/.cache I see stuff for RawTherapee, Darktable, Gimp, GnuCash, and various browsers.

Deleting $HOME/.cache means starting those applications would need to recreate stuff which if one has thousands of photos could be signficant, gnucash I'd have to recreate/reconfigure everytime I start, there are directories related to gstreamer and pretty much every browser I've ever run.

Viable proof: what works for you may not be appropriate for someone else.
 
I run 15 as a desktop so I'm not sure how my situation is different from you? One can overly complicate things which makes finding/understanding a problem more difficult.
There may be reason to run $HOME/.cache as tmpfs for some people, but honestly why not make a user home directory always a tmpfs from the host level and then when a user logs in it gets repopulated from a binary image stored somewhere. Great for security on multiuser systems because the data does not exist if the user is not logged in.
Didn't Poeterring (Mr Systemd) actually propose something like that at one point?
 
Poetring , had many , many , many , bad , ideas ; like restarting services , which are faulty by design;
PS: The only persons to run my pc is myself , one user, so maybe other situation.
 
I run 15 as a desktop so I'm not sure how my situation is different from you? One can overly complicate things which makes finding/understanding a problem more difficult.
There may be reason to run $HOME/.cache as tmpfs for some people, but honestly why not make a user home directory always a tmpfs from the host level and then when a user logs in it gets repopulated from a binary image stored somewhere. Great for security on multiuser systems because the data does not exist if the user is not logged in.
Didn't Poeterring (Mr Systemd) actually propose something like that at one point?
this was the premises behind a product called Deep Freeze that we had to deal with in high school
 
gnucash I'd have to recreate/reconfigure everytime I start
Why? Aren't its config files under ~/.config/?
~/.cache/ is just that, cache, and not configuration, like ~/*, ~/.config/* and ~/.local/*.

Bar some very specific cases, like cracauer@'s LLM example or gstreamer as you mentioned, things like fontconfig and mesa_shader_cache also don't have to be recreated every time one reboots the machine.

Me personally I wouldn't have ~/.cache/ mounted as tmpfs wholesale. I prefer another approach: having some directories symlinked to precreated corresponding files and directories under tmpfs-based /tmp.
 
Why? Aren't its config files under ~/.config/?
~/.cache/ is just that, cache, and not configuration, like ~/*, ~/.config/* and ~/.local/*.

Bar some very specific cases, like cracauer@'s LLM example or gstreamer as you mentioned, things like fontconfig and mesa_shader_cache also don't have to be recreated every time one reboots the machine.

Me personally I wouldn't have ~/.cache/ mounted as tmpfs wholesale. I prefer another approach: having some directories symlinked to precreated corresponding files and directories under tmpfs-based /tmp.
I think yes, config is under $HOME/.config/gnucash but also think about when tmpfs is unmounted.
If it's only unmounted when the system is rebooted and then specifically using $HOME/.cache as example, data under is recreated only when specific applications run, then what problem is actually being solved by having $HOME/.cache mounted tmpfs?

The only thing I can see is cached data for applications like web browsers, but again, if it's only cleared when you reboot, who cares? You can get the same result by adding "rm -rf $HOME/.cache" in your .login/.profile to delete it on your login.
 
~/.config also carries programming language related data.

Python's pip puts everything in there. If you lose it you have to re-download everything on every reboot.

Common Lisp commonly stores the compiled files there, including for quicklisp. You don't want to recompile all your libraries on every reboot.
 
~//.cache can contain data that, yes, is automatically re-created. But it can be very expensive, for example local LLMs can be stored there and you would have to re-download 100 GB per model. You don't want to do that after every reboot.
I can confirm that. Software like Ardour store many things in ~/.cache with big project. It's slow to recreate them each time.
 
Back
Top