Elektrine lite

← Feed

@ryanc@infosec.exchange

2026-09-12 14:05 UTC

STOP DOING SWAP PARTITIONS HARD DRIVES WERE NOT SUPPOSED TO ACT LIKE RAM YEARS OF LINUX SYSADMINNING yet NO REAL-WORLD USE FOUND for going beyond CLOSING A FEW TABS Wanted to avoid the OOM killer anyway for a laugh? We had a tool for that: It was called ZRAM "Yes please give me a dedicated 64GB logical volume of SWAP. Please give me unresizable block devices trapped at the end of my disk." - STATEMENTS DREAMED UP BY THE UTTERLY DERANGED LOOK at what Neckbeards have been demanding your Respect for all this time, with all the fdisk and GParted Live USBs we built for them. (This is REAL PARTITIONING, done by REAL LINUX USERS): # mkswap /dev/nvme0n1p3 # echo /dev/nvme0n1p3 none swap sw 0 0 >> /etc/fstab # swapon -a "Hello I would like to torture my SSD's FTL because I left three Electron apps open." They have played us for absolute fools. #linux #sysadmin

Replies (40)

  • @Kerplunk@mastodon.scot 2026-09-12 19:32

    @ryanc@infosec.exchange Ryan Castellucci (they/them) :nonbinary_flag: @ryanc@infosec.exchange STOP DOING SWAP PARTITIONS HARD DRIVES WERE NOT SUPPOSED TO ACT LIKE RAM You are it seems blinded by luxury of a modern system with 8 or 16 GB of Ram. Many Linux users manage with devices that have 2 GB Ram and can not afford to replace them. Calling those users deranged because they need and use a swap partition is discriminating and deeply insulting.

    Open ##4688034

  • @ryanc@infosec.exchange As I discovered yesterday CachyOS doesn't use a swap file or partition 🙂🤷‍♂️

    Open ##5093862

  • @ATLeagle@mastodon.online 2026-09-12 14:16

    @ryanc@infosec.exchange I come from the times when this made sense. There really is no use on modern systems.

    Open ##5093863

  • @SRAZKVT@tech.lgbt 2026-09-12 14:24

    @ryanc@infosec.exchange i have 8gb of ram and only noticed i had no swap set up a few months after install, no zram either only thing that made me go beyond since is docker and hosting shit for webdev training

    Open ##5093883

  • @m@martinh.net 2026-09-12 14:28

    @ryanc@infosec.exchange TFW you realise your machine belongs to oom-kill now :ms_robot_headpats:

    Open ##5093887

  • @barbra@social.vivaldi.net 2026-09-12 14:31

    @ryanc@infosec.exchange Swap is garbage. Haven't used it since 1995, when I had only 64 mb of ram. With 128 gb of ram there is no scenario I will ever need it.

    Open ##5093888

  • @janl@narrativ.es 2026-09-12 14:36

    @ryanc@infosec.exchange yes and: npm install needing 2GB ram and exploding on a VM with less RAM :(

    Open ##5093889

  • @fichusalon@mas.to 2026-09-12 14:39

    @ryanc@infosec.exchange no need for swap until you launch the VM that was too many

    Open ##5093890

  • @gisgeek@floss.social 2026-09-12 14:43

    @ryanc@infosec.exchange One needs plenty of RAM and these days it is out of question. Before banning swap space, we probably should ban certain programs, such as Internet browsers in all their incarnations. And probably a lot of damn web sites, too.

    Open ##5093891

  • @ryanc@infosec.exchange it’s a good thing RAM is so cheap these days that…

    Open ##5093895

  • @brennan@social.lol 2026-09-12 14:46

    @ryanc@infosec.exchange don't listen to this. Make a 100GB swap partition and you will never run out of RAM.

    Open ##5093896

  • @onion@mastodon.tal.org 2026-09-12 14:54

    @ryanc@infosec.exchange guess where hibernation is done

    Open ##5093903

  • @ryanc@infosec.exchange To me, swap is okay, but only as a red flag that something has gone wrong. The first Unix box I had on my desk was a SPARC 5. I never wanted to see swapping under daily load.

    Open ##5093908

  • @distrowatch@mastodon.social 2026-09-12 15:03

    @ryanc@infosec.exchange zRAM really falls down on systems with low RAM because it's too easy for the system to get stuck in a compression/free RAM/decompression/full RAM/compress again loop. And on systems with more RAM you don't need to use zRAM, so it's pretty useless. Swap on disk makes sense for both hibernating and for pushing out data which is almost never used once the system has finished booting. It clears out some space in RAM and almost never needs to be loaded back from disk.

    Open ##5093916

  • @ryanc@infosec.exchange I am old enough to remember when we did the swap with cassette tapes.

    Open ##5093918

  • @zen@social.net.ua 2026-09-12 15:26

    @ryanc@infosec.exchange try living in Ukraine under constant shelling and missile attacks by ruzzia on civilian and critical infrastructure, such as the energy sector. Swap+hibernate to disk do save your unfinished work even if your battery is discharged to 0%, so you can resume your work when you’re able to charge your laptop. P.S. Soon, WWIII will be in Europe. I recommend picking up some pro tips from us (Ukrainians) on how to survive. #RussiaIsATerroristState

    Open ##5093928

  • @zer0@infosec.exchange 2026-09-12 15:32

    @ryanc@infosec.exchange the disadvantages of zram are well known (cpu overhead due to de/compression and the kernel struggling to free up unused cache space). A configured userspace oom killer clearly adds a lot in term of managing low memory conditions. If you have a machine you wish to run sets of virtual machines concurrently, I'd recommend doing big partitioned swap on nvme. But the reason I'm commenting: If you are doing the local AI thing and you feel like freeing up your nvme swap, you might want to look into repurposing the space into GPUDirectable KV cache: https://docs.lmcache.ai/mp/l2_storage/index.html Checked my neck; we can be friends :flan_thumbs:

    Open ##5093932

  • @mo@mastodon.ml 2026-09-12 15:42

    @ryanc@infosec.exchange well, technically the load will end up on disk anyway, be it swap, or dropped filesystem caches requiring read/write operations but yeah, a partition is definitely not the best way to do it, and if there's no budget to have quadruple amount of memory for stable performance, zram is a no-brainer to me

    Open ##5093936

  • @stefanie@social.anoxinon.de 2026-09-12 16:03

    @ryanc@infosec.exchange everyone knows to put swap at the start of the HDD, because the shorter tracks mean shorter access times 😉

    Open ##5093938

  • @foo_bar_baz@mastodon.social 2026-09-12 16:37

    @ryanc@infosec.exchange Never made a swap partition since i discovered that can do a swap file instead. Don't remember when, long time ago. Nowadays modern kernel has minimized the gap, swap files are more like a practical choice

    Open ##5093939

  • @danvolchek@mastodon.social 2026-09-12 16:37

    @ryanc@infosec.exchange yeah just download more ram instead duh

    Open ##5093940

  • @ganxel@oldbytes.space 2026-09-12 16:51

    @ryanc@infosec.exchange I switched from zram to zswap since it seems to be smarter about which pages to write to disk if memory pressure is too high. Hard to find any useful benchmarks between them to know which is best tho.

    Open ##5093941

  • @SETIEric@mastodon.sdf.org 2026-09-12 16:41

    @ryanc@infosec.exchange I have 768GB of RAM and 1TB of swap on my main system. But I use it for real work.

    Open ##5093942

  • @SETIEric@mastodon.sdf.org 2026-09-12 16:42

    @ryanc@infosec.exchange I have 768GB of RAM and 1TB of swap on my main system. But I use it for real work.

    Open ##5093943

  • @SETIEric@mastodon.sdf.org 2026-09-12 16:49

    @ryanc@infosec.exchange I have 768GB of RAM and 1TB of swap on my main system. It's necessary for the work I do with it. Your system should be designed for the work you do with it. For a desktop with 16gb, zram is probably sufficient. For a pi-zero with 512MB, you might want some additional swap.

    Open ##5093944

  • @SETIEric@mastodon.sdf.org 2026-09-12 16:50

    @ryanc@infosec.exchange I have 768GB of RAM and 1TB of swap on my main system. It's necessary for the work I do with it. Your system should be designed for the work you do with it. For a desktop with 16gb, zram is probably sufficient. For a pi-zero with 512MB, you might want some additional swap.

    Open ##5093945

  • @ryanc@infosec.exchange I will say -- and maybe I'm doing something wrong -- my gaming system (endeavourOS) was completely crashing sporadically in the middle of certain games (like the whole system would freeze and stutter until I powered it off) UNTIL I added a small amount of swap, which completely resolved the issue for me.

    Open ##5093947

  • @ryanc@infosec.exchange hey now. I haven't run swap in over a decade and I'm about braid my neckbeard.

    Open ##5093948

  • @ryanc@infosec.exchange i just do 2 gigs of swap so that when i inevitably run out of ram due to badly designed games and stupid ram prices i get a nice warning in the form of 'why is everything so slow all of a sudden' instead of just crashing

    Open ##5093949

  • @ryanc@infosec.exchange I had a legitimate use case for a swap partition on my NAS (though that was FreeBSD not Linux): I installed it with a BIOS loader. After about ten years, I replaced the motherboard with one that had UEFI with no BIOS compat layer. Having a swap partition meant I could boot a recovery image, shrink the swap partition and add a UEFI boot partition, without any risk to data I cared about.

    Open ##5093950

  • @skyblitz@ieji.de 2026-09-12 20:34

    @ryanc@infosec.exchange you know you can use a swap that run in the ram ? (this "swap" is just a compressed file, slower but allow "more ram" when the ram is full).

    Open ##5093967

  • @ryanc@infosec.exchange finally tried to switch to Linux, set up encrypted root partition with no swap, can’t hibernate because with encrypted root hibernation requires an encrypted swap partition, now I have to be very careful not to let the battery get too low

    Open ##5093969

  • @cancername@mas.to 2026-09-12 20:57

    @ryanc@infosec.exchange tl;dr: no https://chrisdown.name/2018/01/02/in-defence-of-swap.html

    Open ##5093970

  • @ryanc@infosec.exchange Not sure if your serious or not? Have swap on several machines for various reasons, some because they are physically capped at 8GB running whatever w XFCE, some because they are Macs still running MacOS that has it natively. Though those are all SSD though in case of the Core 2 Duo machine stuck w SATA 2 speed.

    Open ##5093976

  • @iseyk@mastodon.social 2026-09-12 21:37

    @ryanc@infosec.exchange I don't understand this at all but I will always laugh at this format

    Open ##5093985

  • @harisont@mstdn.social 2026-09-12 22:28

    @ryanc@infosec.exchange I actually find hibernation very useful, especially on a laptop with a near-dead battery. That requires a swap partition, right? Also sometimes I do run out of ram when I'm both working and running updates

    Open ##5093993

  • @elithebearded@fed.qaz.red 2026-09-12 23:11

    @ryanc@infosec.exchange So swap files?

    Open ##5093994

  • @somebody@circumstances.run 2026-09-13 04:54

    @ryanc@infosec.exchange reading the replies in this thread as an affirmation that my constant rent lowering behavior on main is a wise choice.

    Open ##5093995

  • @shtrom@piaille.fr 2026-09-13 08:13

    @ryanc@infosec.exchange > HARD DRIVES WERE NOT SUPPOSED TO ACT LIKE RAM And that is why I put my swap on a tmpfs ​🧠️🌠️

    Open ##5093996

  • @ryanc@infosec.exchange How do you suspend to disk without swap?

    Open ##5093997