Bonum Certa Men Certa

Messing With ZRAM Again Because IBM Software is Barely Possible to Document and Changes if You Do

Reprinted with permission from Ryan Farmer.

It turns out that when I was setting up Debian, I set up my “zram-generator” systemd configuration file wrong.



systemd is Hell because they never commit themselves to the idea that once you learn how to do anything with it, it will stay working, most of its components are full of bugs and security vulnerabilities, and many things replace something that some other part of the operating system was already doing a lot better.



I cringe every time I give it some new responsibility over my system, waiting for how it will go wrong. I would be using systemd-oomd to handle potential out-of-memory situations, but I’ve read so much about how it handles memory pressure bizarrely and worse than the kernel’s oom-killer, even with the Fedora defaults, that I figure I’ll just leave it alone unless it becomes “mandatory” at some point.



I hear (on Reddit) that systemd-oomd does crazy shit, like, “There are 32 GB of RAM in this system. 12 GB are in use. 20 GB are free. Let’s go on a murder spree and shut down some Chrome tabs and LibreOffice with unsaved work!”



ZRam is a compressed block device that you can use for a compressed swap file in memory. The idea isn’t a bad one, but IBM has made figuring out how to set it up unnecessarily painful because of course it is handled by systemd. You’d think setting up ZRam would be too simple for systemd to bring too much of its usual incompetence to, but nooooo.



Today I actually looked at zramctl and it told me the compression type was lzo-rle, not zstd as I wanted (and was the default on openSUSE and I’m sure that’s what it said when I set it up on Debian and started the service).



Whatever.



Looking around the Web, I found that I needed the line compression-algorithm = zstd in my /etc/systemd/zram-generator.conf file.



So I added it and rebooted, and checked sudo zramctl again and I had zstd compression. Yay!



But when I was looking at the manpage for “zram-generator”, it said that the method by which to specify the fraction of the size of RAM to use was obsolete.



zram-fraction = 1.00 does work, but it’s “obsolete”.



So now it tells me that the “current” way to do the same thing is zram-size=ram/x, where ram is the amount of ram and x is the amount to divide by.



So ram/2 would make the device half of RAM, ram/1 would make it all of your RAM, which is what I wanted.



So now my file looks like this:



# This config file enables a /dev/zram0 swap device with the following
# properties:
# * size: 50% of available RAM or 4GiB, whichever is less
# * compression-algorithm: kernel default
#
# This device’s properties can be modified by adding options under the
# `[zram0]` section, or disabled by removing the section header.
# Additional zram devices can be created by appending new `[zramX]`
# sections and setting the appropriate options for each device.
#
# See /usr/share/doc/systemd-zram-generator/zram-generator.conf.example
# and/or zram-generator.conf(5) for a list of available options.
[zram0]
zram-size=ram/1
compression-algorithm = zstd



I’m not exactly sure why IBM Red Hat keeps screwing around changing the way you do this. They make you memorize something only to make pointless changes to the way it’s done, but then the stupid thing doesn’t want to break existing setups, so they just say the old one is “obsolete”.



$ sudo zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 15.4G 4K 64B 4K 8 [SWAP]



At least this thing is finally set up right, I think.



They never let you get too sure that you did it right or it wouldn’t be “modern”.



As to the debate about zstd vs lzo-rle, they’re both decent choices.



I can see the logic of defaulting to either one, depending on who you think your users are.



If you have a multi-core x86 PC with lots of CPU performance to burn, zstd makes more sense because of higher compression ratios.



If you have some little ARM system that you bought down at the Micro-Center and don’t want to overload it, but still do want to use ZRam, lzo-rle is a respectable choice.



If anything, ZRam with zstd has gotten faster since the kernel developers have last updated the default and I suspect it deserves another look.

Recent Techrights' Posts

Net Gain of 50 Gemini Capsules in Just One Month
a big jump in just one month
Keeping Linux Reliable
If Linux becomes a lot more reliable in the future, it'll be an "hey hi" miracle. If Linux becomes a lot less reliable in the future, we'll know why and who is responsible for it.
Cyber Show on the Fallacy of Salary/Ego as a Function of Wisdom in the Era of Pyramid Schemes (Cheating People Using Buzzwords and Complicit Media)
"the remuneration fallacy and the role of reluctance as a negative feedback force."
EPO's Local Staff Committee Munich Organises General Assembly Next Week, the Goal is to Oust the Corrupt President and Derail His Unlawful Agenda
They're aiming to show Campinos the door
 
Why Cyber Resilience Act (CRA) Won't Work
American companies don't follow laws, they work around them
IBM Isn't Reporting Layoffs, But It Removes Tens of Thousands of People From Its Workforce
Red Hat and IBM already mark people for removal
"A Tale of Two Antónios" Will Resume Soon
In November the site turns 20
Links 11/09/2026: Cyberattack in Berlin (Windows/Microsoft TCO) and Hype About Slop as 'Existential' Something; Scam Altman et al Caught Stealing/Plagiarising "Mathematical Breakthrough"
Links for the day
Microsoft/GNOME 9/11
Garrett and Graveley (Microsoft/GNOME) will have a lot to explain
9/11 Was a National Event, Not an International Event
They insist that back doors will "save lives"
Very Sloppy PR From a Dying IBM, Company in Disarray and in Need of Distractions
IBM could really use distractions right now
What a Price-Fixing Cartel Can Look Like
If your prices increase five-fold or ten-fold and so do your revenues/income, what does that tell us?
SLAPP Censorship - Part 178 Out of 200: Explaining to Your American Clients That Spending 130,000+ United States Dollars on a Single Hearing in Another Continent Means the UK's National Archives Will Retain in Perpetuity What Your Spouse or Girlfriend Said
Balabhadra (Alex) Graveley should ask Garrett how much money he has lost so far
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Thursday, September 10, 2026
IRC logs for Thursday, September 10, 2026
Latest IBM Gossip is, Over 25,000 People to be PIPed (by Year's End)
That figure, 10%, is different from 15% (what we saw a lot). 10% is over 25,000 staff.
Solidarity at EPO
"Many colleagues have made personal and professional sacrifices by participating in the ongoing strike and work-to-rule action"
Gemini Links 11/09/2026: Culture Stuck, Robot Symphony, and Back to Geminispace
Links for the day
Links 10/09/2026: Facebook Unsafe for Kids, Fake Songs (Against Right of Publicity, CG Forgeries Basically) a Growing Problem
Links for the day
Rust is Financially and Technically Controlled by Microsoft. Rust Foundation is a Front for Microsoft's Proprietary Software.
Rust is not and has never been about security
Gemini Links 10/09/2026: "I Don’t Want to Interact With Stochastic Parrots" and "ROOPHLOCH 2026!"
Links for the day
What the British School Closure (BSN Senior School Leidschenveen) Means to EPO Staff
The only European thing about the EPO is the staff
Standing in Solidarity With Matt Mullenweg
I don't trust the people and companies that want Mullenweg out. Neither should you.
Links 10/09/2026: "Smear Campaign Says Anti-Flock Movement Is Chinese Propaganda" and "Flock Employee Calls Cops on Reporter Filming Them"
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Wednesday, September 09, 2026
IRC logs for Wednesday, September 09, 2026
IBM's Senior VP of Infrastructure is Out, Silent Layoffs Still Going On
Some people imagine the CEO will also "retire" very soon (and "ahead of time")
Gemini Links 09/09/2026: Mechanical Cameras, "Super App", and Prusa Issues
Links for the day
SLAPP Censorship - Part 177 Out of 200: Manosphere Without Financial Transparency
It has moreover replaced a female worker with a male
Deadline Tomorrow (10th of September) to Appeal the EPO's Fleecing of Staff (Union to Make Legal Challenges)
Join them. Fight the good fight.
linuxstans.com Died, Then Came Back as Slop (LLM Junk)
Don't make the mistake or the assumption that merely 'dabbling in' or 'experimenting with' LLMs can be forgivable as it is a trust destroyer
Links 09/09/2026: GAFAM Fatalities in Miami International Airport, "Britain’s Health Crisis Is Becoming a Political Crisis"
Links for the day
Gemini Links 09/09/2026: "Adjective Is Subjective" and Walled Gardens
Links for the day
Plagiarism is Hardly a New Problem, It Predates Mainstream Media Getting Paid to Whitewash It as "Training" or "Hey Hi", Then Conflate Plagiarism With "Intelligence" or Deferred "Value"
"Quantum" isn't new either; it's a 'circle-jerk' for companies without direction, only hype
Links 09/09/2026: Airport 'Down' (Glasgow and Edinburgh), 'Open' 'AI' Losses Rise to Pace of 50 Billion Dollars in Losses Per Year
Links for the day
Unsafe at Any Speed, "Modern" Appliances
Appliances have gotten worse
SLAPP Censorship - Part 176 Out of 200: The Sex-Obsessed Non-Experts
We heard some sexual stories
European Patent Office (EPO): No Transparency and No Paper Trail
The incompetence is that of the management, i.e. sheer incompetence of people who never examined a patent in their entire lifetime
Gemini Links 09/09/2026: Going Out, Smartphone Addiction, Mapping the Geminispace
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Tuesday, September 08, 2026
IRC logs for Tuesday, September 08, 2026