From Fedora Project Wiki
Description
Test installation of zram-generator
and zram-generator-defaults
(enables swap-on-zram by default)
How to test
- We recommend to remove 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
- Install
zram-generator
andzram-generator-defaults
:sudo dnf install zram-generator zram-generator-defaults
- Reboot your machine
- Verify that swap-on-zram is active.
zramctl
should list the/dev/zram0
device and show it mounted as[SWAP]
. Example:$ zramctl NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT /dev/zram0 lzo-rle 1.4G 4K 74B 12K 2 [SWAP]
- Verify that the size of the device in the output above (
DISKSIZE
column) has a size equal to 50% of installed memory, or 4 GiB, whichever is smaller. - Verify that
swapon
lists the/dev/zram0
device. Example:$ swapon NAME TYPE SIZE USED PRIO /dev/vda1 partition 500M 0B -2 /dev/zram0 partition 1.4G 0B 100
If you have another swap device present, like in the example above, that is not a problem. Unless you configured your swap priority manually, your pre-existing swap device should have a lower priority than the new
/dev/zram0
device. - Verify the service unit file is marked as "active (exited)" and its output looks OK with no errors or issues listed.
$ 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: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
- The
zram-generator
andzram-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.