Test installation of
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
sudo dnf install zram-generator zram-generator-defaults
- Reboot your machine
- Verify that swap-on-zram is active.
zramctlshould list the
/dev/zram0device and show it mounted as
$ 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 (
DISKSIZEcolumn) has a size equal to 50% of installed memory, or 4 GiB, whichever is smaller.
- Verify that
$ 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
- Verify the service unit file is marked as "active (exited)" and its output looks OK with no errors or issues listed.
$ sudo systemctl status email@example.com ● firstname.lastname@example.org - 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: Starting Create swap on /dev/zram0... Jun 28 19:24:57 fmac.local zram-generator: Setting up swapspace version 1, size = 3.8 GiB (4105170944 bytes) Jun 28 19:24:57 fmac.local zram-generator: no label, UUID=03831cdf-96df-4a7a-a6c2-3bc8406f33f3 Jun 28 19:24:57 fmac.local systemd: Finished Create swap on /dev/zram0.
zram-generator-defaultsare 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.