From Fedora Project Wiki

(initial writeup)
 
(improve instructions)
Line 1: Line 1:
 
{{QA/Test_Case
 
{{QA/Test_Case
|description=Test disable swap-on-zram right now!
+
|description=Test stopping the swap-on-zram service temporarily.
 +
 
 +
|setup=
 +
# A system with swap-on-zram [[QA:Testcase SwapOnZRAM install and enable|installed and enabled]].
  
 
|actions=
 
|actions=
 
<ol>
 
<ol>
<li> swap-on-zram should be enabled and running to start this test.
+
<li> Stop the swap-on-zram service:
<li> Turn off swap-on-zram:
+
<pre>sudo systemctl stop swap-create@zram0.service</pre>
<pre>sudo systemctl stop swap-create@zram0</pre>
+
<li> Confirm it's stopped. The service should be marked as "`inactive (dead)`":
<li> Confirm it's stopped:
+
<pre>$ sudo systemctl status swap-create@zram0.service
<pre> sudo systemctl status swap-create@zram0
 
 
● swap-create@zram0.service - Create swap on /dev/zram0
 
● swap-create@zram0.service - Create swap on /dev/zram0
 
     Loaded: loaded (/usr/lib/systemd/system/swap-create@.service; static; vendor preset: disabled)
 
     Loaded: loaded (/usr/lib/systemd/system/swap-create@.service; static; vendor preset: disabled)
Line 26: Line 28:
 
Jun 28 19:32:07 fmac.local systemd[1]: swap-create@zram0.service: Succeeded.
 
Jun 28 19:32:07 fmac.local systemd[1]: swap-create@zram0.service: Succeeded.
 
Jun 28 19:32:07 fmac.local systemd[1]: Stopped Create swap on /dev/zram0.
 
Jun 28 19:32:07 fmac.local systemd[1]: Stopped Create swap on /dev/zram0.
[chris@fmac ~]$ zramctl
+
</pre>
[chris@fmac ~]$ swapon
+
`zramctl` should list no device:
 +
<pre>$ zramctl
 +
</pre>
 +
`swapon` should only list your disk swap partitions and no `/dev/zram0` device:
 +
<pre>$ swapon
 
NAME      TYPE      SIZE USED PRIO
 
NAME      TYPE      SIZE USED PRIO
 
/dev/sda5 partition 10.4G  0B  -2
 
/dev/sda5 partition 10.4G  0B  -2
 
</pre>
 
</pre>
<li> Optional: Set it back to running, and confirm.
+
<li> Start the swap-on-zram service again and confirm it's running:
<pre> sudo systemctl start swap-create@zram0
+
<pre>$ sudo systemctl start swap-create@zram0.service
[chris@fmac ~]$ sudo systemctl status swap-create@zram0
+
$ sudo systemctl status swap-create@zram0
 
● swap-create@zram0.service - Create swap on /dev/zram0
 
● swap-create@zram0.service - Create swap on /dev/zram0
 
     Loaded: loaded (/usr/lib/systemd/system/swap-create@.service; static; vendor preset: disabled)
 
     Loaded: loaded (/usr/lib/systemd/system/swap-create@.service; static; vendor preset: disabled)
Line 47: Line 53:
 
Jun 28 19:32:54 fmac.local zram-generator[1582]: no label, UUID=f046c6d8-3f69-4f21-81ae-a7b1555891d9
 
Jun 28 19:32:54 fmac.local zram-generator[1582]: no label, UUID=f046c6d8-3f69-4f21-81ae-a7b1555891d9
 
Jun 28 19:32:54 fmac.local systemd[1]: Finished Create swap on /dev/zram0.
 
Jun 28 19:32:54 fmac.local systemd[1]: Finished Create swap on /dev/zram0.
$ </pre>
+
</pre>
 
</ol>
 
</ol>
  
 
|results=
 
|results=
# Status should be inactive (dead).
+
# Stopping the service should work without issues and it should remove the `/dev/zram0` device, i.e. it will no longer be visible in `zramctl` and `swapon` commands output.
# There should be no /dev/zram0 device listed for the `zramctl` and `swapon` commands.
 
 
}}
 
}}
  
 
[[Category:Test Days Test Cases]]
 
[[Category:Test Days Test Cases]]

Revision as of 14:56, 1 July 2020

Description

Test stopping the swap-on-zram service temporarily.

Setup

  1. A system with swap-on-zram installed and enabled.

How to test

  1. Stop the swap-on-zram service:
    sudo systemctl stop swap-create@zram0.service
  2. Confirm it's stopped. The service should be marked as "inactive (dead)":
    $ sudo systemctl status swap-create@zram0.service
    ● swap-create@zram0.service - Create swap on /dev/zram0
         Loaded: loaded (/usr/lib/systemd/system/swap-create@.service; static; vendor preset: disabled)
         Active: inactive (dead) since Sun 2020-06-28 19:32:07 MDT; 3s 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)
        Process: 1565 ExecStop=/usr/lib/systemd/system-generators/zram-generator --reset-device zram0 (code=exited, status=0/SUCCESS)
       Main PID: 646 (code=exited, status=0/SUCCESS)
            CPU: 25ms
    
    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.
    Jun 28 19:32:07 fmac.local systemd[1]: Stopping Create swap on /dev/zram0...
    Jun 28 19:32:07 fmac.local systemd[1]: swap-create@zram0.service: Succeeded.
    Jun 28 19:32:07 fmac.local systemd[1]: Stopped Create swap on /dev/zram0.
    

    zramctl should list no device:

    $ zramctl
    

    swapon should only list your disk swap partitions and no /dev/zram0 device:

    $ swapon
    NAME      TYPE       SIZE USED PRIO
    /dev/sda5 partition 10.4G   0B   -2
    
  3. Start the swap-on-zram service again and confirm it's running:
    $ sudo systemctl start swap-create@zram0.service
    $ 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:32:54 MDT; 3s ago
           Docs: man:zram-generator(8)
                 man:zram-generator.conf(5)
        Process: 1580 ExecStart=/usr/lib/systemd/system-generators/zram-generator --setup-device zram0 (code=exited, status=0/SUCCESS)
       Main PID: 1580 (code=exited, status=0/SUCCESS)
            CPU: 33ms
    
    Jun 28 19:32:54 fmac.local systemd[1]: Starting Create swap on /dev/zram0...
    Jun 28 19:32:54 fmac.local zram-generator[1582]: Setting up swapspace version 1, size = 3.8 GiB (4105170944 bytes)
    Jun 28 19:32:54 fmac.local zram-generator[1582]: no label, UUID=f046c6d8-3f69-4f21-81ae-a7b1555891d9
    Jun 28 19:32:54 fmac.local systemd[1]: Finished Create swap on /dev/zram0.
    

Expected Results

  1. Stopping the service should work without issues and it should remove the /dev/zram0 device, i.e. it will no longer be visible in zramctl and swapon commands output.