Jim Lesurf writes:
Richard Kettlewell wrote:
Jim Lesurf writes:
So what would you suggest in terms of a filing system address like
/run/user.... ? If your answer is "none of them" then I will stick
with what suits me and leave others to do what they prefer. But if
there is a common and recommended 'location', I can use it.
As I said, use $TMPDIR if set, otherwise use /tmp. It's a standard
location for temporary files and is often a tmpfs.
I'll need to unpack that because of my ignorance.
My mint laptop (for example) has /tmp. But 'df' doesn't list it, so does
that mean its on the main SDD simply as a directory. i.e. *not* a tempfs
(or ramfs) on ram?
In general, yes.
If you want your own /tmp to be a tmpfs, do that.
That I don't currently know how to do. Nor do I know if it might give
a problem for something else. There are already two directories inside
/tmp.
I don’t know Mint. But:
In Debian systems, historically, you could edit /etc/default/tmpfs and
set RAMTMP=yes. /tmp would be a tmpfs after the next reboot. In newer
Debian systems, with systemd, you’d enable tmp.mount.
On practically any Linux system adding a line to /etc/fstab should work.
Again, it would take effect after the next reboot.
Migrating to any different filesystem on /tmp without a reboot risks
breaking the running things that rely on it, hence the general theme of
rebooting to turn it on.
If you want a guarantee that your program will always have a tmpfs
available at some predictable location: sorry, you can't have one.
I take it that by "can't" what you really mean is that "the user would have
to be willing to create one. Which in turn means I'd have to explain /
request that *if* I wanted them to use a tempfs"?
Yes. There’s no filename you can bake into your program that will
always be a tmpfs.
--
http://www.greenend.org.uk/rjk/