From Fedora Project Wiki

(initial writeup)
 
(add one more check, service unit file itself)
Line 23: Line 23:
 
</pre>
 
</pre>
 
Notice that `/dev/zram0` is present. If you have another swap device present, like in the example above, that is not a problem.
 
Notice that `/dev/zram0` is present. If you have another swap device present, like in the example above, that is not a problem.
 +
<li> Verify the service unit file is <span style="color:green">active (exited)</span> and sanity checks OK.
 +
<pre> sudo systemctl status swap-create@zram0
 +
● swap-create@zram0.service - Create swap on /dev/zram0
 +
    Loaded: loaded (/usr/lib/systemd/system/swap-create@.service; static; vendor preset: disabled)
 +
    Active: active (exited) since Sun 2020-06-28 19:24:57 MDT; 36s ago
 +
      Docs: man:zram-generator(8)
 +
            man:zram-generator.conf(5)
 +
    Process: 646 ExecStart=/usr/lib/systemd/system-generators/zram-generator --setup-device zram0 (code=exited, status=0/SUCCESS)
 +
  Main PID: 646 (code=exited, status=0/SUCCESS)
 +
        CPU: 32ms
 +
 +
Jun 28 19:24:57 fmac.local systemd[1]: Starting Create swap on /dev/zram0...
 +
Jun 28 19:24:57 fmac.local zram-generator[648]: Setting up swapspace version 1, size = 3.8 GiB (4105170944 bytes)
 +
Jun 28 19:24:57 fmac.local zram-generator[648]: no label, UUID=03831cdf-96df-4a7a-a6c2-3bc8406f33f3
 +
Jun 28 19:24:57 fmac.local systemd[1]: Finished Create swap on /dev/zram0.
 +
$ </pre>
 +
 
</ol>
 
</ol>
  

Revision as of 01:30, 29 June 2020

Description

Test installation zram-generator and zram-generator-defaults (default enabled)


How to test

  1. Recommend removing the following packages. The swap-on-zram implementations in those packages have minor conflicts with zram-generator, but mostly they'll just contribute to user confusion.
    sudo dnf remove anaconda zram
  2. Install zram-generator and its defaults package:
    sudo dnf install zram-generator zram-generator-defaults
    
  3. Reboot your machine
  4. Verify that swap-on-zram is active.
    $ zramctl 
    NAME       ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
    /dev/zram0 lzo-rle       1.4G   4K   74B   12K       2 [SWAP]
    

    Notice that /dev/zram0 device is present and it's mounted as [SWAP].

  5. Verify that swapon lists the zram device:
    $ swapon 
    NAME       TYPE      SIZE USED PRIO
    /dev/vda1  partition 500M   0B   -2
    /dev/zram0 partition 1.4G   0B   -3
    

    Notice that /dev/zram0 is present. If you have another swap device present, like in the example above, that is not a problem.

  6. Verify the service unit file is active (exited) and sanity checks OK.
     sudo systemctl status swap-create@zram0
    ● swap-create@zram0.service - Create swap on /dev/zram0
         Loaded: loaded (/usr/lib/systemd/system/swap-create@.service; static; vendor preset: disabled)
         Active: active (exited) since Sun 2020-06-28 19:24:57 MDT; 36s ago
           Docs: man:zram-generator(8)
                 man:zram-generator.conf(5)
        Process: 646 ExecStart=/usr/lib/systemd/system-generators/zram-generator --setup-device zram0 (code=exited, status=0/SUCCESS)
       Main PID: 646 (code=exited, status=0/SUCCESS)
            CPU: 32ms
    
    Jun 28 19:24:57 fmac.local systemd[1]: Starting Create swap on /dev/zram0...
    Jun 28 19:24:57 fmac.local zram-generator[648]: Setting up swapspace version 1, size = 3.8 GiB (4105170944 bytes)
    Jun 28 19:24:57 fmac.local zram-generator[648]: no label, UUID=03831cdf-96df-4a7a-a6c2-3bc8406f33f3
    Jun 28 19:24:57 fmac.local systemd[1]: Finished Create swap on /dev/zram0.
    $ 

Expected Results

  1. The zram-generator and zram-generator-defaults are installed without issues, and the feature is automatically activated after a reboot with the proper size. It should have a size equal to 50% of installed memory, or 4GiB, whichever is smaller.