weinzierl

There used to be a time when not only the OS required using partitions for optimum performace (swapfiles) but also applications.

In the late 90s databases were regularly set up in a way to store their data on raw partitions. There were other types of applications too that required partitions but for databases it was really common.

The practice really only died with OSes allowing apps to bypass the normal filesystem cache.

In Linux this is O_DIRECT and interestingly Linux was super late to the party because Linus hated it with a passion. Now, he was far from the only one, at least Alan Cox and Andrew Morton were skeptical, others as well. Linus was unusually extreme about it and that particular discussion is probably the single source of the majority of quotes people use against him.

ducktective

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?

show comments
williebeek

Remember when distros used complicated partition setups, one for /root, one for /var one for /home, a swap partition etc. Was always a bad choice because one of them would be at 99% while others would linger below 10%

For swap, the best advice is to disable swap on your desktop, unless <8GB RAM. Really, I've never needed it and you probably won't either.

show comments
cfstras

swap files make setting up hibernation a bit more complicated - in most cases the file has to be contiguous, e.g. you have to defragment it once after allocating. Then, you need to tell the bootloader the byte offset of the file on the partition.

show comments
Kim_Bruning

Every rule has an exception. Beware of this advice on zfs, for instance.

Meanwhile zswap (of no relation with zfs) is free performance. Is it a rule that everything starting with a 'z' must be cool?

show comments
mcculley

It would be nice if the VFS had a hook for providing swap pages, making this manual futzing less necessary.

dwedge

Interestingly I always use swapfiles and this page made me realise there can be a performance impact if the filesystem is old - the lkml link says as long as the swap file isn't fragmented there's no impact

show comments
mdspan

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

show comments
holowoodman

Stop using partitions. Use LVM!

show comments
crabbone

Oh, the irony of:

    echo "/swapfile none swap defaults 0 0" >> /etc/fstab
If we are going full modern, why not create a Systemd unit? ( https://www.freedesktop.org/software/systemd/man/latest/syst... ) if you need more info. If you didn't know this: /etc/fstab is not used directly after the pivot. Systemd parses it, creates units for every record in it, and that's what gets executed in reality. I can't imagine why would you want a swap file before pivot.
show comments
charcircuit

Linux distros that do use swap files do so statically. It doesn't handle dynamically growing and shrinking it like other operating systems.

show comments
waynesonfire

It's a terrible idea to delegate swap, a capability that is expected to operate under severe memory pressure, to a subsystem that fails under such conditions.