Where else can tmpfs be mounted besides /tmp?

No,no,no, .config has configuration after reboots.

Code:
% du -s ~/.cache/* | sort -n
[...]
133840  /home/cracauer/.cache/RawTherapee
291204  /home/cracauer/.cache/calibre
322308  /home/cracauer/.cache/pip
353200  /home/cracauer/.cache/wine
1327628 /home/cracauer/.cache/mozilla
3401344 /home/cracauer/.cache/common-lisp
 
  • Like
Reactions: mer
Another question nobody asked: Does it actually help performance? Did anyone measure before suggesting it?

My educated guess: A file system with atime turned off and the async option will be just as fast; the occasional disk write is asynchronous, and it can use less memory if there is pressure.
 
  • Like
Reactions: mer
Another question nobody asked: Does it actually help performance? Did anyone measure before suggesting it?

My educated guess: A file system with atime turned off and the async option will be just as fast; the occasional disk write is asynchronous, and it can use less memory if there is pressure.
Thank you. This meshes nicely with my question about "what problem is being solved by having $HOME/.cache tmpfs", which I don't think has been answered yet.
 
Yes. You can safely delete the contents of ~/.cache/pip at any time.
This was AI....
No, Python itself does not install into ~/.cache/pip. That directory is used specifically by pip (Python's package manager) as a storage unit to speed up future installations.
 
then what problem is actually being solved by having $HOME/.cache mounted tmpfs?
As I said, I don't do that. Only for some specific subdirectories, not the entire .cache directory.

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.
Because the files are not created on the disk to start with. The advantage of keeping all of the browser's cache and history is, for me at least, marginal at best.
With some websites — LLM-powered search engines among others, I've noticed — I see constant disk activity. With a memory-based profile, no more disk churning.
Right now, with an uptime of less than 3 hours, my browser's profile is worth more than 370MB and 11,000 files. That's only after checking these forums and a few YouTube channels. All of that would be on my user profile, growing and growing every day. No thanks.
 
As I said, I don't do that. Only for some specific subdirectories, not the entire .cache directory.


Because the files are not created on the disk to start with. The advantage of keeping all of the browser's cache and history is, for me at least, marginal at best.
With some websites — LLM-powered search engines among others, I've noticed — I see constant disk activity. With a memory-based profile, no more disk churning.
Right now, with an uptime of less than 3 hours, my browser's profile is worth more than 370MB and 11,000 files. That's only after checking these forums and a few YouTube channels. All of that would be on my user profile, growing and growing every day. No thanks.
Ok, but if tmpfs is only cleared on reboot, all that growing is currently happening in memory, memory that is only reclaimed on reboot. What is more important, memory or storage space?
If you really don't care about $HOME/.cache, put a line rm -rf $HOME/.cache in your .xinitrc.

So maybe no more disk churning, but at the cost of less available memory. It's one thing if we are talking about "10s of MB" but completely different if we are talking "10s of GB".

Memory vs physical storage. Me, for most cases, I'll take more available memory
 
df -h -t tmpfs
Code:
Filesystem    Size    Used   Avail Capacity  Mounted on
tmpfs         2,0G    2,4M    2,0G     0%    /tmp
tmpfs         1,0G    596K    1,0G     0%    /var/tmp
tmpfs         4,0G    451M    3,6G    11%    /SSD/home/x/.cache
tmpfs         2,0G     63M    1,9G     3%    /usr/local/poudriere/data/.m/pjailA-defaultA/ref/.p
tmpfs          10G    4,0K     10G     0%    /usr/local/poudriere/data/.m/pjailA-defaultA/ref/wrkdirs
tmpfs          10G     36K     10G     0%    /usr/local/poudriere/data/.m/pjailA-defaultA/ref/var/db/ports
tmpfs         2,0G     11M    2,0G     1%    /usr/local/poudriere/data/.m/pjailA-defaultA/01/.p
tmpfs          10G    6,2G    3,8G    62%    /usr/local/poudriere/data/.m/pjailA-defaultA/01/wrkdirs
 
But it does feel like a purer spot for /tmp

What feels out of place in /var is system /var/db/pkg.
Delete that and you are done.

I have been learning the webserver lighttpd and by default it creates a /usr/local/www/lighttpd/ directory.
In absence of good directions I used that direction to host my website. It did feel dirty changing ownership of directories under /usr/local/ so I switched to /var/www/ which many instructions use.
That felt better to me.

I must admit I question paths sometimes.
cp -vr /usr/local/etc/xdg/openbox/ /user/.config/openbox

Why is /usr/local/etc/xdg/ used for "Prototypes" and not /usr/local/share/xdg/ ???
 
I have one /usr/local/www ,
it's a soft link.
/usr/local "should" contain installed packages.
/usr/local/www is different.
Sometimes you need to change ownership , and or permissions. And or a config file.

P.S. : /usr/local/share is for installed packages , not a specific user.
 
I have been learning the webserver lighttpd and by default it creates a /usr/local/www/lighttpd directory.
In absence of good directions I used that direction to host my website. It did feel dirty changing ownership of directories under /usr/local/ so I switched to /var/www/ which many instructions use.
That felt better to me.
I saw /var/www with Fedora first but /srv/www with openSUSE; I thought /var/www was a RHEL thing but Ubuntu iirc uses it too (srv seems better as serve; oS also has the ftp folder there for vsftpd). FreeBSD I went with the /usr/local/www default.

I didn't really know of a folder to put www at on Windows, but C:\www seems fine so far :p
 
When i want to ditch every package is just
rm -vfR /usr/local
ok,
But hey, there is /usr/local/www , now for me this is a soft link, to another zfs mount ...
Learned my lesson.
/usr/local/www bad boy.
 
Indeed. But why , or why not.
That's more kind of a historical question, and if you are on a single user, or multiuser machine.
Today on single user machines, unless we deal with large software suites, big games, or videos we don't care much about storage memory anymore - there commonly is way more than enough; if not, attach another 1TB drive, and forget about it. Or, to be more correct, we deal with way much larger amounts to be normal.
What is a megabyte today, according to today's storage devices? Nothing. You can buy a 16..64 GB USB flashdrive at every supermarket's check-out for a few bucks.
While in real data you actually create yourself - write some text/code yourself, or get some measurement values from an experiment (e.g. by some ADC) one MB actually still is very much.
You need to see until the ... - let's say app. 1990s - memory was very valuable, expensive, especially on multiuser machines. So using "public" tmp before you save the extracted value from it to your limited, precious /home/... was a choice.
In fact it was good manners to use /tmp/ this way still today, before you trash up your /home/ or other filesystems with garbage.

However, the question was good, I wanted to ask it myself in this thread, though not about /tmp/ but why
using tmpfs besides /tmp/?
Don't get me wrong. Since I (yet) see no good reason to do so, I wanna learn if there are any.
AFAIK tmpfs is to put a FS into RAM. Besides /tmp/ I don't see no good reason to place any other FS into RAM.
I once thought about to do that with /var/. But after I gave it a thought, I came to the conclusion: Bad idea. You may give /var/ it's own partition, or even better an own drive, but place it into RAM is no good idea if it's done trivial.
 
using zfs here , no tmpfs on var, except /var/tmp, but in zfs you can do tuning ...
mount -v | grep var | sort
Code:
SSD/var on /var (zfs, local, nfsv4acls, vnodes: count 104 )
SSD/var/cache on /var/cache (zfs, local, nfsv4acls, vnodes: count 4 )
SSD/var/cache/pkg on /var/cache/pkg (zfs, local, nfsv4acls, vnodes: count 2 )
SSD/var/db on /var/db (zfs, local, nfsv4acls, vnodes: count 518 )
SSD/var/db/grafana on /var/db/grafana (zfs, local, nfsv4acls, vnodes: count 2 )
SSD/var/db/influxdb on /var/db/influxdb (zfs, local, nfsv4acls, vnodes: count 2 )
SSD/var/db/mariadb on /var/db/mariadb (zfs, local, nfsv4acls, vnodes: count 2 )
SSD/var/db/pkg on /var/db/pkg (zfs, local, nfsv4acls, vnodes: count 8 )
SSD/var/db/postgresql on /var/db/postgresql (zfs, local, nfsv4acls, vnodes: count 2 )
SSD/var/db/prometheus on /var/db/prometheus (zfs, local, nfsv4acls, vnodes: count 2 )
SSD/var/log on /var/log (zfs, local, nfsv4acls, vnodes: count 50 )
tmpfs on /var/tmp (tmpfs, local, vnodes: count 9 )
 
Just for everybody's information, FreeBSD's current tmpfs(4) file contents are pageable.

When the system gets low on memory the contents of files in tmpfs are moved to swapspace. just like process read-wrote data is.

So you do not in fact take RAM away from the system unconditionally.
 
I once thought about to do that with /var/. But after I gave it a thought, I came to the conclusion: Bad idea. You may give /var/ it's own partition, or even better an own drive, but place it into RAM is no good idea if it's done trivial.
I tried to run /var in memorydisk and various other schemes due to disk writes. None worked well or better that stock setup. Don't micromanage. OS needs to do some small writes.
Lesson learned. Use MFS if you have serious RO needs.
 
Just for everybody's information, FreeBSD's current tmpfs(4) file contents are pageable.

When the system gets low on memory the contents of files in tmpfs are moved to swapspace. just like process read-wrote data is.

So you do not in fact take RAM away from the system unconditionally.
Seams reasonable, mostly , that is 95% percent of time i use firefox & neovim-qt.
In background sometimes , poudriere, when i tune wrong system dies, now 100G of swap, so i'm safe.
And poudriere i run with , "nice -n 31 idprio 31"
 
I tried to run /var in memorydisk and various other schemes
You proved in fact scientifically, what I only did theoretically as a thought experiment:
"What happens, when /var/ was in RAM?"
The system needs /var/.
You may put it into RAM - theoretically - and theoretically it was a good idea: faster than any storage drive, not wearing out any drive, since /var/ is the system's most frequent used access. BUT: You must have stored it savely up-to-date to a drive anyway. This means: you need to load it from a drive into RAM very early at system start. And you need to save it safely to storage at the latest, when the system goes down. But you have no coverage if the system crashes. So 'No!' to /var/ into RAM. You may give it an own, fast drive, but no RAM.
 
Back
Top