Live data from Hacker News

Stop making swap partitions—use swap files instead

gist.github.com

11–20 of 256 posts

Re: Stop making swap partitions—use swap files instead

#12
post #4
post #2

Swap files are also much easier to set up than partitions if you're using full disk encryption.

Swap files are very fragile if you are using hibernation. For FDE I prefer LVM-over-LUKS and a dedicate partition

MacOS seems to have no problem with hibernating and it and its predecessor NeXT have been using swap files for over 30 years.

Re: Stop making swap partitions—use swap files instead

#14
Tangential, but does anyone know why in 2026 and on Debian 13, my machine still hangs when some process exhausts RAM?

Is there really no higher-priority kernel process to prevent total freeze of the system and send a SIGKILL to the culprit process when such a scenario happens?

Re: Stop making swap partitions—use swap files instead

#16

Tangential, but does anyone know why in 2026 and on Debian 13, my machine still hangs when some process exhausts RAM? Is there really no higher-priority kernel process to prevent total freeze of the system and send a SIGKILL to the culprit process when such a scenario happens?

I always install earlyoom for that reason

Re: Stop making swap partitions—use swap files instead

#17

Tangential, but does anyone know why in 2026 and on Debian 13, my machine still hangs when some process exhausts RAM? Is there really no higher-priority kernel process to prevent total freeze of the system and send a SIGKILL to the culprit process when such a scenario happens?

This is called an oomkiller. The kernel has one but it kicks in very late and the kernel prefers to do page trashing instead of killing processes.

systemd-oomd should be integrated in systemd, you can configure it to your liking and see if it improves your problem.

Re: Stop making swap partitions—use swap files instead

#18

Tangential, but does anyone know why in 2026 and on Debian 13, my machine still hangs when some process exhausts RAM? Is there really no higher-priority kernel process to prevent total freeze of the system and send a SIGKILL to the culprit process when such a scenario happens?

OS are designed to fully exploit available resources, Linux tries its best before triggering an OOM kill.

I recommend using the earlyoom if you want more aggresive oom kill:

https://github.com/rfjakob/earlyoom

The README contains a lot of interesting information.

Re: Stop making swap partitions—use swap files instead

#19
post #4

Earlier quoted context omitted.

Swap files are very fragile if you are using hibernation. For FDE I prefer LVM-over-LUKS and a dedicate partition

MacOS seems to have no problem with hibernating and it and its predecessor NeXT have been using swap files for over 30 years.

MacOS has no problem with hibernation because hardware and software are designed together: it uses TPM to manage swap encryption. I assume "BIOS" is also optimized to enable fast boot on sleep.

Linux can work with TPM but it's never as smooth. (Unless I guess you make it custom for your specific setup.)

Re: Stop making swap partitions—use swap files instead

#20

Tangential, but does anyone know why in 2026 and on Debian 13, my machine still hangs when some process exhausts RAM? Is there really no higher-priority kernel process to prevent total freeze of the system and send a SIGKILL to the culprit process when such a scenario happens?

This is called an oomkiller. The kernel has one but it kicks in very late and the kernel prefers to do page trashing instead of killing processes. systemd-oomd should be integrated in systemd, you can configure it to your liking and see if it improves your problem.

I believe that you mean: https://en.wikipedia.org/wiki/Thrashing_(computer_science)

Chris Siebenmann discusses when the OOM killer triggers: https://utcc.utoronto.ca/~cks/space/blog/linux/OOMKillerWhen

Chris disables systemd-oomd after it obliterates his X session with no explanation: https://utcc.utoronto.ca/~cks/space/blog/linux/SystemdOomdNo...

Post reply on HN