From Fedora Project Wiki
Chrismurphy (talk | contribs) (initial writeup) |
(improve instructions) |
||
Line 1: | Line 1: | ||
{{QA/Test_Case | {{QA/Test_Case | ||
|description=Test | |description=Test swap-on-zram with a custom configuration. | ||
|setup= | |||
# A system with swap-on-zram [[QA:Testcase SwapOnZRAM install and enable|installed and enabled]]. | |||
|actions= | |actions= | ||
<ol> | <ol> | ||
<li> Create a custom configuration file, which will override the default configuration file: | |||
<li> Create a custom configuration file | <pre>sudo cp /usr/share/doc/zram-generator/zram-generator.conf.example /etc/systemd/zram-generator.conf</pre> | ||
<pre> | <li> Edit the configuration file, read the included documentation, and set custom values. (Pay attention to `host-memory-limit`, if you have more total memory than this value, the zram device will not get created at all). | ||
<pre>sudo nano /etc/systemd/zram-generator.conf</pre> | |||
<li> Confirm | <li> Restart the swap-on-zram service to apply your changes: | ||
<pre> | <pre>sudo systemctl restart swap-create@zram0.service</pre> | ||
$ sudo systemctl status swap-create@zram0 | <li> Confirm the swap-on-zram service was run correctly (its status is `active (exited)`): | ||
<pre>$ sudo systemctl status swap-create@zram0.service | |||
● 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 24: | Line 28: | ||
Jun 28 19:52:48 fmac.local zram-generator[653]: no label, UUID=72991b9c-f8fd-459c-9bb8-6e8ac19a16c2 | Jun 28 19:52:48 fmac.local zram-generator[653]: no label, UUID=72991b9c-f8fd-459c-9bb8-6e8ac19a16c2 | ||
Jun 28 19:52:48 fmac.local systemd[1]: Finished Create swap on /dev/zram0. | Jun 28 19:52:48 fmac.local systemd[1]: Finished Create swap on /dev/zram0. | ||
$ zramctl | </pre> | ||
<li> Look at `zramctl` and `swapon` output and confirm the zram device is configured according to your custom values you've set in the configuration file. | |||
<pre>$ zramctl | |||
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT | NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT | ||
/dev/zram0 lzo-rle 512M 4K 73B 12K 8 [SWAP] | /dev/zram0 lzo-rle 512M 4K 73B 12K 8 [SWAP] | ||
$ swapon | $ 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 | ||
/dev/zram0 partition 512M 0B 100 | /dev/zram0 partition 512M 0B 100 | ||
</pre> | |||
<li> After you verified this test case, return back to the original state by deleting the custom configuration file and again restarting the service (or rebooting): | |||
<pre>sudo rm /etc/systemd/zram-generator.conf | |||
sudo systemctl restart swap-create@zram0.service | |||
</pre> | |||
</ol> | </ol> | ||
|results= | |results= | ||
# | # The swap-on-zram service should start correctly. | ||
# | # The values you set in the configuration file should correctly affect the zram swap device (size, algorithm, whether it exists at all, etc). | ||
}} | }} | ||
[[Category:Test Days Test Cases]] | [[Category:Test Days Test Cases]] |
Revision as of 18:39, 1 July 2020
Description
Test swap-on-zram with a custom configuration.
Setup
- A system with swap-on-zram installed and enabled.
How to test
- Create a custom configuration file, which will override the default configuration file:
sudo cp /usr/share/doc/zram-generator/zram-generator.conf.example /etc/systemd/zram-generator.conf
- Edit the configuration file, read the included documentation, and set custom values. (Pay attention to
host-memory-limit
, if you have more total memory than this value, the zram device will not get created at all).sudo nano /etc/systemd/zram-generator.conf
- Restart the swap-on-zram service to apply your changes:
sudo systemctl restart swap-create@zram0.service
- Confirm the swap-on-zram service was run correctly (its status is
active (exited)
):$ 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: active (exited) since Sun 2020-06-28 19:52:48 MDT; 1min 0s ago Docs: man:zram-generator(8) man:zram-generator.conf(5) Process: 650 ExecStart=/usr/lib/systemd/system-generators/zram-generator --setup-device zram0 (code=exited, status=0/SUCCESS) Main PID: 650 (code=exited, status=0/SUCCESS) CPU: 28ms Jun 28 19:52:48 fmac.local systemd[1]: Starting Create swap on /dev/zram0... Jun 28 19:52:48 fmac.local zram-generator[653]: Setting up swapspace version 1, size = 512 MiB (536866816 bytes) Jun 28 19:52:48 fmac.local zram-generator[653]: no label, UUID=72991b9c-f8fd-459c-9bb8-6e8ac19a16c2 Jun 28 19:52:48 fmac.local systemd[1]: Finished Create swap on /dev/zram0.
- Look at
zramctl
andswapon
output and confirm the zram device is configured according to your custom values you've set in the configuration file.$ zramctl NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT /dev/zram0 lzo-rle 512M 4K 73B 12K 8 [SWAP] $ swapon NAME TYPE SIZE USED PRIO /dev/sda5 partition 10.4G 0B -2 /dev/zram0 partition 512M 0B 100
- After you verified this test case, return back to the original state by deleting the custom configuration file and again restarting the service (or rebooting):
sudo rm /etc/systemd/zram-generator.conf sudo systemctl restart swap-create@zram0.service
Expected Results
- The swap-on-zram service should start correctly.
- The values you set in the configuration file should correctly affect the zram swap device (size, algorithm, whether it exists at all, etc).