Zram on Centos 7 / Nethserver 7

Fedora 29 is running zram 0.2-1 as a systemd service. I just started my F29-arm system. I am vnced into my Xfce DE and started Firefox. A quick check on swap:

# swapon -s
Filename				Type		Size	Used	Priority
/dev/zram0                             	partition	487304	10752	-2

# zramctl
NAME       ALGORITHM DISKSIZE  DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lz4         475.9M 11.2M  4.3M  4.9M       2 [SWAP]

There is a conf file:

cat /etc/zram.conf 
# The factor is the percentage of total system RAM to allocate to the ZRAM block device(s).
FACTOR=2

The service file has:

# cat /etc/systemd/system/swap.target.wants/zram-swap.service
[Unit]
Description=Enable compressed swap in memory using zram
DefaultDependencies=no
Before=swap.target

[Service]
Type=oneshot
RemainAfterExit=yes
TimeoutStartSec=30sec
ExecStart=/usr/sbin/zramstart
ExecStop=/usr/sbin/zramstop

[Install]
WantedBy=swap.target

Checking on the status:

# systemctl -l --no-pager status zram-swap
\u25cf zram-swap.service - Enable compressed swap in memory using zram
   Loaded: loaded (/usr/lib/systemd/system/zram-swap.service; enabled; vendor preset: disabled)
   Active: active (exited) since Fri 2018-06-22 11:12:12 EDT; 3 months 16 days ago
  Process: 437 ExecStart=/usr/sbin/zramstart (code=exited, status=0/SUCCESS)
 Main PID: 437 (code=exited, status=0/SUCCESS)

Jun 22 11:12:12 localhost zramstart[437]: Setting up swapspace version 1, size = 475.9 MiB (498999296 bytes)
Jun 22 11:12:12 localhost zramstart[437]: no label, UUID=ba3bf62f-7bb0-4295-ad8c-2d26b000c3f8
Jun 22 11:12:12 localhost zramstart[437]: Activated ZRAM swap device of 499 MB
Jun 22 11:12:12 localhost systemd[1]: Started Enable compressed swap in memory using zram.

Ignore that Jun 22 date; armv7 SOC tend NOT to have a battery clock. So Fedora29-arm starts somehow with this Jun 22nd date and then counts on Chrony to fix the date, which is will do even a pretty good job with no network connection (using datetime stamp on drift file).

2 Likes