{"id":68534,"date":"2022-11-11T09:00:41","date_gmt":"2022-11-11T09:00:41","guid":{"rendered":"https:\/\/www.cryptocabaret.com\/?p=68534"},"modified":"2022-11-11T09:00:41","modified_gmt":"2022-11-11T09:00:41","slug":"drop-swap-for-zram-on-linux","status":"publish","type":"post","link":"https:\/\/www.cryptocabaret.com\/?p=68534","title":{"rendered":"Drop swap for zram on Linux"},"content":{"rendered":"<p><span class=\"field field--name-title field--type-string field--label-hidden\">Drop swap for zram on Linux<\/span><br \/>\n<span class=\"field field--name-uid field--type-entity-reference field--label-hidden\"><a title=\"View user profile.\" href=\"https:\/\/opensource.com\/users\/dboth\" class=\"username\">David Both<\/a><\/span><br \/>\n<span class=\"field field--name-created field--type-created field--label-hidden\">Fri, 11\/11\/2022 &#8211; 03:00<\/span><\/p>\n<div class=\"clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item\">\n<p>I spend a lot of time playing (I mean <em>working<\/em>) on my computers, and I&#8217;ve found a lot of interesting things. One that has most recently come to my attention is the <code>zram0<\/code> device. I first noticed it when working on one of my Opensource.com articles several months ago. It showed up in the output from the <code>lsblk<\/code> command:<\/p>\n<pre class=\"highlight\">\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\"><span class=\"co0\"># lsblk<\/span><br>\nNAME \u00a0 \u00a0 \u00a0 \u00a0 \u00a0MAJ:MIN RM \u00a0 SIZE RO TYPE MOUNTPOINTS<br>\nsda \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"nu0\">8<\/span>:<span class=\"nu0\">0<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> 931.5G \u00a0<span class=\"nu0\">0<\/span> disk<br>\n\u251c\u2500sda1 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span class=\"nu0\">8<\/span>:<span class=\"nu0\">1<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 600M \u00a0<span class=\"nu0\">0<\/span> part<br><span class=\"br0\">[<\/span>...<span class=\"br0\">]<\/span><br>\nzram0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"nu0\">252<\/span>:<span class=\"nu0\">0<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 \u00a0 8G \u00a0<span class=\"nu0\">0<\/span> disk <span class=\"br0\">[<\/span>SWAP<span class=\"br0\">]<\/span><\/div><\/div><\/pre>\n<p>It&#8217;s identified as swap space, which is what first piqued my curiosity, so I did some exploration. Zram was originally called &#8220;compcache,&#8221; which stands for &#8220;compressed cache.&#8221; It turns out that zram is a tool for creating an in-RAM compressed cache, specifically for use as swap space.<\/p>\n<p>But Why?<\/p>\n<\/p>\n<div class=\"embedded-resource-list callout-float-right\">\n<div class=\"field field--name-title field--type-string field--label-hidden field__item\">More Linux resources<\/div>\n<div class=\"field field--name-links field--type-link field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/cheat-sheets\/linux-commands-cheat-sheet\/?intcmp=70160000000h1jYAAQ\">Linux commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/cheat-sheets\/advanced-linux-commands\/?intcmp=70160000000h1jYAAQ\">Advanced Linux commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/services\/training\/rh024-red-hat-linux-technical-overview?intcmp=70160000000h1jYAAQ\">Free online course: RHEL technical overview<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/cheat-sheet-networking?intcmp=70160000000h1jYAAQ\">Linux networking cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/cheat-sheet-selinux?intcmp=70160000000h1jYAAQ\">SELinux cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/linux-common-commands-cheat-sheet?intcmp=70160000000h1jYAAQ\">Linux common commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/resources\/what-are-linux-containers?intcmp=70160000000h1jYAAQ\">What are Linux containers?<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/linux?intcmp=70160000000h1jYAAQ\">Our latest Linux articles<\/a><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<p>When I began researching zram, all I found were a couple of basic articles about using zram for swap space. At first, this seemed a bit counterintuitive to me. After all, if you&#8217;re running out of RAM and you swap pages into a virtual drive in RAM, what&#8217;s gained?<\/p>\n<p>I then found the Fedora Project wiki page that proposed the use of <a href=\"https:\/\/fedoraproject.org\/wiki\/Changes\/SwapOnZRAM\">Swap on zram<\/a>. The proposal says: &#8220;Swap is useful, except when it&#8217;s slow. zram is a RAM drive that uses compression. Create a swap-on-zram during start-up. And no longer use swap partitions by default.&#8221;<\/p>\n<p>The rest of the page is about details, benefits, side effects, and feedback.<\/p>\n<h2>Zram for swap space on Linux<\/h2>\n<p>Using zram for swap space is intended to do the same thing as regular partition-based or file-based swap space. When memory pressure becomes too great, some of the least recently used data is moved to swap space. On average, it&#8217;s compressed to about 50% of its original size, and placed in zram space in RAM. This is much faster than storing those memory pages on a hard drive and frees up the RAM it was using for other use.<\/p>\n<h2>Saving on swap<\/h2>\n<p>I tried to find revised recommendations for how much swap or zram swap to configure. This led me back to a reassessment of swap, and my previous article, <a href=\"https:\/\/opensource.com\/article\/19\/2\/swap-space-poll\">What&#8217;s the right amount of swap space for a modern Linux system?<\/a> As far as I can tell from the most current documentation for RHEL and Fedora, the recommended amount of swap space has not changed. That documentation, however, ignores the use of zram.<\/p>\n<p>However, the tables in that previous article still provide a good starting point for swap space allocation when using older releases of Linux that don&#8217;t use zram or in cases where zram has been disabled.<\/p>\n<p>The documents I found for the Zram feature are inconsistent in terms of how zram is allocated with respect to RAM size, and the amount of space allocated to zram swap.<\/p>\n<p>Due to the lack of authoritative documentation, I performed some experiments to empirically determine the algorithm used to allocate zram swap. I used my own physical and virtual systems for this. The results are interesting and do not match any documentation I&#8217;ve so far found.<\/p>\n<p>The default size of zram is 8 GB on all systems large enough to support that, but it&#8217;s typically reduced significantly on hosts with small amounts of RAM. On one virtual machine (VM) I use for testing, with access to 4 GB of RAM, the zram virtual swap space is allocated to 3.8 GB. One old Dell I have contains 8 GB of RAM, and the zram is set to 7.6 GB. When RAM is reduced to 2 GB, Zram is reduced to 1.9 GB.<\/p>\n<p>All physical and virtual hosts I have with more than 8 GB of RAM show exactly 8 GB of zram. This includes my primary workstation with 64 GB of RAM and other hosts with 16 GB or 32 GB of RAM.<\/p>\n<p>Based on these few data points, I can draw the conclusion that the current default settings are for 8 GB of zram at most, and for zram to be 95% of RAM on hosts with 8 GB or less.<\/p>\n<p>I have read a number of articles that mention other sizes for zram swap, even up to 100% of RAM, but those all seem to be theoretical rather than reality.<\/p>\n<p>Your distribution may be different, but here are the actual zram swap allocations for Fedora and similar distributions:<\/p>\n<ul>\n<li>\n<p><strong>RAM \u21d0 8 GB:<\/strong> 0.95 \u00d7 RAM<\/p>\n<\/li>\n<li>\n<p><strong>RAM &gt; 8 GB:<\/strong> 8 GB<\/p>\n<\/li>\n<\/ul>\n<p>Be aware that the zram swap size algorithm is not based on any recommendations for the &#8220;best&#8221; swap size for any given real-world system or application. This zram swap allocation is a rather probabilistic approach to what should work well on a wide range of Linux hosts. However, the fact that the maximum zram swap size is configured for 8 GB and the fact that I have always recommended 8 GB as the maximum amount of traditional swap, I think I can say it&#8217;s reflective of the optimum sizes for zram swap.<\/p>\n<h2>Managing zram swap<\/h2>\n<p>Zram defaults are stored in the <code>\/usr\/lib\/systemd\/zram-generator.conf<\/code> configuration file. The following is from one of my test VMs with 5097 GB of RAM allocated.<\/p>\n<pre class=\"highlight\">\n<div class=\"geshifilter\"><div class=\"ini geshifilter-ini\"># cat \/usr\/lib\/systemd\/zram-generator.conf<br>\n# This config file enables a \/dev\/zram0 device with the default settings:<br>\n# - size - same as available RAM or 8GB, whichever is less<br>\n# - compression - most likely lzo-rle<br>\n#<br>\n# To disable, uninstall zram-generator-defaults or create empty<br>\n# \/etc\/systemd\/zram-generator.conf file.<br><span class=\"re0\"><span class=\"br0\">[<\/span>zram0<span class=\"br0\">]<\/span><\/span><br><span class=\"re1\">zram-size<\/span> <span class=\"sy0\">=<\/span><span class=\"re2\"> min<span class=\"br0\">(<\/span>ram, 8192<span class=\"br0\">)<\/span><\/span><\/div><\/div><\/pre>\n<p>You can change the default Zram swap size in the last line of the <code>zram-generator.conf<\/code> configuration file. I recommend against doing that, unless you can definitively show a reason for doing so, and test your results once you make any changes. Like many other configuration defaults in Linux, the zram ones have been well-tested and are appropriate for most use cases.<\/p>\n<h2>Monitor zram<\/h2>\n<p>The zramctl utility can be used to view the current state of zram.<\/p>\n<pre class=\"highlight\">\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\"><span class=\"co0\"># zramctl<\/span><br>\nNAME \u00a0 \u00a0 \u00a0 ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT<br><span class=\"sy0\">\/<\/span>dev<span class=\"sy0\">\/<\/span>zram0 lzo-rle \u00a0 \u00a0 \u00a0 4.8G \u00a0 4K \u00a0 80B \u00a0 12K \u00a0 \u00a0 \u00a0 <span class=\"nu0\">4<\/span> <span class=\"br0\">[<\/span>SWAP<span class=\"br0\">]<\/span><\/div><\/div><\/pre>\n<p>The traditional <code>swapon<\/code> command can also be used to view swap including zram used as swap:<\/p>\n<pre class=\"highlight\">\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\"><span class=\"co0\"># swapon --show<\/span><br>\nNAME \u00a0 \u00a0 \u00a0 TYPE \u00a0 \u00a0 \u00a0SIZE USED PRIO<br><span class=\"sy0\">\/<\/span>dev<span class=\"sy0\">\/<\/span>zram0 partition 4.8G \u00a0 0B \u00a0<span class=\"nu0\">100<\/span><\/div><\/div><\/pre>\n<p>One thing to be aware of is that <code>zramctl<\/code> does not report on zram when it contains no data, so the results contain null output. Tools like <code>lsblk<\/code>, <code>swapon<\/code>, <code>top<\/code>, <code>free<\/code>, <code>htop<\/code>, and so on, do show zram even when it contains no data.<\/p>\n<h2>Deactivate zram<\/h2>\n<p>The <code>swapoff -a<\/code> command turns off <code>zram<\/code> swap as well as traditional HDD or SSD storage used as swap. The <code>swapon -a<\/code> command does not show zram when it is empty. Use <code>zramctl \/dev\/zram0<\/code> instead.<\/p>\n<pre class=\"highlight\">\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\"><span class=\"co0\"># swapon --show<\/span><br><span class=\"co0\"># lsblk<\/span><br>\nNAME \u00a0 \u00a0 \u00a0 \u00a0 \u00a0MAJ:MIN RM \u00a0SIZE RO TYPE MOUNTPOINTS<br>\nsda \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"nu0\">8<\/span>:<span class=\"nu0\">0<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0120G \u00a0<span class=\"nu0\">0<\/span> disk<br>\n\u251c\u2500sda1 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span class=\"nu0\">8<\/span>:<span class=\"nu0\">1<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 \u00a01G \u00a0<span class=\"nu0\">0<\/span> part <span class=\"sy0\">\/<\/span>boot<span class=\"sy0\">\/<\/span>efi<br>\n\u251c\u2500sda2 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span class=\"nu0\">8<\/span>:<span class=\"nu0\">2<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 \u00a01G \u00a0<span class=\"nu0\">0<\/span> part <span class=\"sy0\">\/<\/span>boot<br>\n\u2514\u2500sda3 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span class=\"nu0\">8<\/span>:<span class=\"nu0\">3<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0118G \u00a0<span class=\"nu0\">0<\/span> part<br>\n\u00a0 \u251c\u2500vg01-root <span class=\"nu0\">253<\/span>:<span class=\"nu0\">0<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 10G \u00a0<span class=\"nu0\">0<\/span> lvm \u00a0<span class=\"sy0\">\/<\/span><br>\n\u00a0 \u251c\u2500vg01-swap <span class=\"nu0\">253<\/span>:<span class=\"nu0\">1<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 \u00a03G \u00a0<span class=\"nu0\">0<\/span> lvm \u00a0<span class=\"br0\">[<\/span>SWAP<span class=\"br0\">]<\/span><br>\n\u00a0 \u251c\u2500vg01-usr \u00a0<span class=\"nu0\">253<\/span>:<span class=\"nu0\">1<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 30G \u00a0<span class=\"nu0\">0<\/span> lvm \u00a0<span class=\"sy0\">\/<\/span>usr<br>\n\u00a0 \u251c\u2500vg01-home <span class=\"nu0\">253<\/span>:<span class=\"nu0\">2<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 10G \u00a0<span class=\"nu0\">0<\/span> lvm \u00a0<span class=\"sy0\">\/<\/span>home<br>\n\u00a0 \u251c\u2500vg01-var \u00a0<span class=\"nu0\">253<\/span>:<span class=\"nu0\">3<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 30G \u00a0<span class=\"nu0\">0<\/span> lvm \u00a0<span class=\"sy0\">\/<\/span>var<br>\n\u00a0 \u2514\u2500vg01-tmp \u00a0<span class=\"nu0\">253<\/span>:<span class=\"nu0\">4<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 10G \u00a0<span class=\"nu0\">0<\/span> lvm \u00a0<span class=\"sy0\">\/<\/span>tmp<br>\nsr0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span class=\"nu0\">11<\/span>:<span class=\"nu0\">0<\/span> \u00a0 \u00a0<span class=\"nu0\">1<\/span> 1024M \u00a0<span class=\"nu0\">0<\/span> rom<br>\nzram0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"nu0\">252<\/span>:<span class=\"nu0\">0<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 \u00a00B \u00a0<span class=\"nu0\">0<\/span> disk<br><span class=\"co0\"># zramctl<\/span><br><span class=\"co0\">#<\/span><br><span class=\"co0\"># zramctl \/dev\/zram0<\/span><br>\nNAME \u00a0 \u00a0 \u00a0 ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT<br><span class=\"sy0\">\/<\/span>dev<span class=\"sy0\">\/<\/span>zram0 lzo-rle \u00a0 \u00a0 \u00a0 \u00a0 0B \u00a0 0B \u00a0 \u00a00B \u00a0 \u00a00B \u00a0 \u00a0 \u00a0 <span class=\"nu0\">4<\/span><\/div><\/div><\/pre>\n<p>Note that <code>\/dev\/zram0<\/code> doesn&#8217;t show up in these commands as swap space until it&#8217;s being used for that purpose. This caused me some confusion until my experiments showed it to be the case.<\/p>\n<h2>Creating Zram Swap<\/h2>\n<p>Zram itself has been around for about 20 years, but has only been in use as swap space on some distributions for the last year or two. The current Linux installation on some or all of your hosts may not have been created with zram for swap. If that&#8217;s the case, it can be easily remedied.<\/p>\n<p>For Fedora 32, the last release prior to the default use of zram for swap, it only takes three easy commands.<\/p>\n<p>First, verify the presence of the <code>zram-swap.service<\/code> file, installed as part of the <code>zram<\/code> RPM package.<\/p>\n<pre class=\"highlight\">\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\"><span class=\"co0\"># systemctl status zram-swap<\/span><br>\n\u25cf zram-swap.service - Enable compressed swap <span class=\"kw1\">in<\/span> memory using zram<br>\n\u00a0 \u00a0 \u00a0Loaded: loaded <span class=\"br0\">(<\/span><span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>lib<span class=\"sy0\">\/<\/span>systemd<span class=\"sy0\">\/<\/span>system<span class=\"sy0\">\/<\/span>zram-swap.service; disabled; vendor preset: disabled<span class=\"br0\">)<\/span><br>\n\u00a0 \u00a0 \u00a0Active: inactive <span class=\"br0\">(<\/span>dead<span class=\"br0\">)<\/span><\/div><\/div><\/pre>\n<p>Next, install the <code>zram-generator-defaults<\/code> and <code>zram-generator<\/code> packages.<\/p>\n<pre class=\"highlight\">\n<span class=\"geshifilter\"><code class=\"bash geshifilter-bash\"><span class=\"co4\"># <\/span>dnf <span class=\"kw2\">install<\/span> zram-generator-defaults zram-generator<\/code><\/span><\/pre>\n<p>Enable and start the zram-swap service:<\/p>\n<pre class=\"highlight\">\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\"><span class=\"co0\"># systemctl enable zram-swap.service<\/span><br><span class=\"co0\"># systemctl start zram-swap.service<\/span><\/div><\/div><\/pre>\n<p>And then verify that <code>zram0<\/code> exists, and is being used as swap space:<\/p>\n<pre class=\"highlight\">\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\"><span class=\"co0\"># lsblk<\/span><br>\nNAME \u00a0 \u00a0 \u00a0 \u00a0 \u00a0MAJ:MIN RM \u00a0SIZE RO TYPE MOUNTPOINT<br>\nsda \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"nu0\">8<\/span>:<span class=\"nu0\">0<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0120G \u00a0<span class=\"nu0\">0<\/span> disk<br>\n\u251c\u2500sda1 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span class=\"nu0\">8<\/span>:<span class=\"nu0\">1<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 \u00a02G \u00a0<span class=\"nu0\">0<\/span> part <span class=\"sy0\">\/<\/span>boot<br>\n\u2514\u2500sda2 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span class=\"nu0\">8<\/span>:<span class=\"nu0\">2<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0118G \u00a0<span class=\"nu0\">0<\/span> part<br>\n\u00a0 \u251c\u2500vg01-root <span class=\"nu0\">253<\/span>:<span class=\"nu0\">0<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 10G \u00a0<span class=\"nu0\">0<\/span> lvm \u00a0<span class=\"sy0\">\/<\/span><br>\n\u00a0 \u251c\u2500vg01-swap <span class=\"nu0\">253<\/span>:<span class=\"nu0\">1<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 \u00a03G \u00a0<span class=\"nu0\">0<\/span> lvm \u00a0<span class=\"br0\">[<\/span>SWAP<span class=\"br0\">]<\/span><br>\n\u00a0 \u251c\u2500vg01-usr \u00a0<span class=\"nu0\">253<\/span>:<span class=\"nu0\">2<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 35G \u00a0<span class=\"nu0\">0<\/span> lvm \u00a0<span class=\"sy0\">\/<\/span>usr<br>\n\u00a0 \u251c\u2500vg01-tmp \u00a0<span class=\"nu0\">253<\/span>:<span class=\"nu0\">3<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 15G \u00a0<span class=\"nu0\">0<\/span> lvm \u00a0<span class=\"sy0\">\/<\/span>tmp<br>\n\u00a0 \u251c\u2500vg01-var \u00a0<span class=\"nu0\">253<\/span>:<span class=\"nu0\">4<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 35G \u00a0<span class=\"nu0\">0<\/span> lvm \u00a0<span class=\"sy0\">\/<\/span>var<br>\n\u00a0 \u2514\u2500vg01-home <span class=\"nu0\">253<\/span>:<span class=\"nu0\">5<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a0 20G \u00a0<span class=\"nu0\">0<\/span> lvm \u00a0<span class=\"sy0\">\/<\/span>home<br>\nsr0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span class=\"nu0\">11<\/span>:<span class=\"nu0\">0<\/span> \u00a0 \u00a0<span class=\"nu0\">1<\/span> 1024M \u00a0<span class=\"nu0\">0<\/span> rom<br>\nzram0 \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"nu0\">252<\/span>:<span class=\"nu0\">0<\/span> \u00a0 \u00a0<span class=\"nu0\">0<\/span> \u00a07.5G \u00a0<span class=\"nu0\">0<\/span> disk <span class=\"br0\">[<\/span>SWAP<span class=\"br0\">]<\/span><\/div><\/div><\/pre>\n<h2>Improve swap with zram<\/h2>\n<p>That&#8217;s all there is to it. It was easy with Fedora. Different distributions will likely be just as easy, with some possible different details in the package names and commands. Give zram swap a try on your computer. In my next article, I&#8217;ll demonstrate some further zram options.<\/p>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-field-article-subhead field--type-text-long field--label-hidden field__item\">\n<p>Zram is a tool for creating an in-RAM compressed cache, specifically for use as swap space.<\/p>\n<\/div>\n<div class=\"field field--name-field-lead-image field--type-entity-reference field--label-hidden field__item\">\n<article class=\"media media--type-image media--view-mode-caption\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/11\/car-penguin-drive-linux-yellow.png\" width=\"520\" height=\"292\" alt=\"How Linux got to be Linux: Test driving 1993-2003 distros\" title=\"How Linux got to be Linux: Test driving 1993-2003 distros\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>Internet Archive Book Images. Modified by Opensource.com. CC BY-SA 4.0<\/p>\n<\/div>\n<\/article>\n<\/div>\n<div class=\"field field--name-field-tags field--type-entity-reference field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/linux\" hreflang=\"en\">Linux<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/sysadmin\" hreflang=\"en\">Sysadmin<\/a><\/div>\n<\/p><\/div>\n<div class=\"hidden field field--name-field-listicle-title field--type-string field--label-hidden field__item\">What to read next<\/div>\n<div class=\"field field--name-field-default-license field--type-list-string field--label-hidden field__item\"><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\"><br \/>\n        <img decoding=\"async\" alt=\"Creative Commons License\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/11\/cc-by-sa--14.png\" title=\"This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.\"><\/a>This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.<\/div>\n<section class=\"field field--name-field-comments field--type-comment field--label-hidden comment-wrapper\">\n<div class=\"comments__count\">\n<div class=\"login\"><a href=\"https:\/\/opensource.com\/user\/register?absolute=1\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?destination=\/feed&amp;absolute=1\">Login<\/a> to post a comment.<\/div>\n<\/p><\/div>\n<\/section>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\" rel=\"noopener\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Drop swap for zram on Linux David Both Fri, 11\/11\/2022 &#8211; 03:00 I spend a lot of time playing (I mean working) on my computers, and I&#8217;ve found a lot of interesting things. One that has most recently come to my attention is the zram0 device. I first noticed it when working on one of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":68535,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[307],"tags":[],"class_list":["post-68534","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-open-source"],"_links":{"self":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/68534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=68534"}],"version-history":[{"count":0,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/68534\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/media\/68535"}],"wp:attachment":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=68534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=68534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=68534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}