From Fedora Project Wiki
Description
Test enable swap-on-zram with a custom configuration.
How to test
- swap-on-zram should be enabled and running to start this test.
- Create a custom configuration file.
$ sudo cp /usr/share/doc/zram-generator/zram-generator.conf.example /etc/systemd/zram-generator.conf $ sudo nano /etc/systemd/zram-generator.conf <li> Confirm you're getting the results you expect. <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: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. $ 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 $
Expected Results
- Status should be active (exited).
- There should be a
/dev/zram0
device listed for thezramctl
properly sized, with the compression algorithm you specified in the configuration file. - The
/dev/zram0
device should appear for theswapon
command, with the proper size and a priority of 100.