From Fedora Project Wiki
Description
Test stopping the swap-on-zram service temporarily.
Setup
- A system with swap-on-zram installed and enabled.
How to test
- Stop the swap-on-zram service:
sudo systemctl stop swap-create@zram0.service
- 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
- 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
- Stopping the service should work without issues and it should remove the
/dev/zram0
device, i.e. it will no longer be visible inzramctl
andswapon
commands output.