News for hackers. Stuff that matters.
Re:Save your disk, write files directly into RAM with /dev/shm by pkulak on Thursday June 26, 2025 @08:43PM (#44392866)
You know what, your comment actually reminds me that this happened when I also had a bug in my configuration that was causing me to not actually use swap. I assume running out of tmpfs uses swap like anything else? I might give tmpfs another try.
Re:Save your disk, write files directly into RAM with /dev/shm by AdieuToLogic on Thursday June 26, 2025 @09:47PM (#44393113)
> I assume running out of tmpfs uses swap like anything else?

This is not the case. RAM-based file system capacities are unrelated to process memory usage, of which "swap space" is for the latter.

Re:Save your disk, write files directly into RAM with /dev/shm by tatref on Thursday June 26, 2025 @10:46PM (#44393314)
That's why on some configurations (RHEL 7 I think), journald will happily fill up your ram via /run/
Re:Save your disk, write files directly into RAM with /dev/shm by AdieuToLogic on Thursday June 26, 2025 @11:33PM (#44393476)
> That's why on some configurations (RHEL 7 I think), journald will happily fill up your ram via /run/

I do not run systemd-based distros, so cannot relate.

Re:Save your disk, write files directly into RAM with /dev/shm by pkulak on Friday June 27, 2025 @10:11PM (#44401896)
btw
Re:Save your disk, write files directly into RAM with /dev/shm by pkulak on Thursday June 26, 2025 @10:28PM (#44393245)
Interesting, thank you. I stand by my original point, downvotes be damned.
Re:Save your disk, write files directly into RAM with /dev/shm by AdieuToLogic on Thursday June 26, 2025 @10:49PM (#44393330)
> Interesting, thank you.

Glad to help out. Here[0] is more information regarding Linux swap space as it relates to processes and the VMM subsystem.

> I stand by my original point, downvotes be damned.

:-D

0 - https://phoenixnap.com/kb/swap-space

Re:Save your disk, write files directly into RAM with /dev/shm by AdieuToLogic on Friday June 27, 2025 @05:34PM (#44400450)
I was wrong in my unconditional assertion that `tmpfs` does not use swap. It can, depending on conditions described here[0].

What I was thinking about is `ramfs`, which does not use/support swap and has other limitations not present in `tmpfs`.

Sorry for confusing the topic.

0 - https://www.kernel.org/doc/html/latest/filesystems/tmpfs.htm...

Re:Save your disk, write files directly into RAM with /dev/shm by buckle8017 on Friday June 27, 2025 @12:48AM (#44393779)
tmpfs will swap.
Re:Save your disk, write files directly into RAM with /dev/shm by AdieuToLogic on Friday June 27, 2025 @05:30PM (#44400424)
> tmpfs will swap.

We are both wrong to a degree, but you are more correct than I was.

According to the docs[0]:

  tmpfs ... is able to swap unneeded pages out to swap
  space, if swap was enabled for the tmpfs mount.
So `tmpfs` does not unconditionally use swap, but can use it if possible. What I was thinking about is `ramfs`, which doesn't support swap, but that is not the topic of the question to which I replied.

0 - https://www.kernel.org/doc/html/latest/filesystems/tmpfs.htm...

Re:Save your disk, write files directly into RAM with /dev/shm by buckle8017 on Saturday June 28, 2025 @03:53AM (#44402971)
You have to explicitly disable swap.

Honestly had no idea that was an option because I've never seen it disabled anywhere before.

Re:Save your disk, write files directly into RAM with /dev/shm by AdieuToLogic on Sunday June 29, 2025 @09:46PM (#44418383)
> You have to explicitly disable swap.

> Honestly had no idea that was an option because I've never seen it disabled anywhere before.

Disabling swap is common with embedded systems, such as network gateways, routers, and other devices having no intrinsic mass storage devices.

Re:Save your disk, write files directly into RAM with /dev/shm by buckle8017 on Wednesday July 09, 2025 @06:47AM (#44508373)
No like there's a tmpfs mount flag to not allow swapping.
Re:Save your disk, write files directly into RAM with /dev/shm by buckle8017 on Friday June 27, 2025 @12:31AM (#44393717)
Sibling is wrong tmpfs will swap.

Maybe some other ram disk things won't.