systemd / zram-generator

Systemd unit generator for zram devices
MIT License
575 stars 48 forks source link

Device is created, but not used? #168

Closed lnicola closed 1 year ago

lnicola commented 1 year ago

Sorry, I'm new to zram. I tried to install your program (on Arch), created a configuration file:

[zram0]
zram-size = ram / 4

activated the service:

● systemd-zram-setup@zram0.service - Create swap on /dev/zram0
     Loaded: loaded (/usr/lib/systemd/system/systemd-zram-setup@.service; static)
     Active: active (exited) since Fri 2022-11-04 17:56:39 EET; 3min 43s ago
       Docs: man:zram-generator(8)
             man:zram-generator.conf(5)
    Process: 3933 ExecStart=/usr/lib/systemd/system-generators/zram-generator --setup-device zram0 (code=exited, status=0/SUCCESS)
   Main PID: 3933 (code=exited, status=0/SUCCESS)
         IP: 0B in, 0B out
        CPU: 8ms

Nov 04 17:56:39 heidr systemd[1]: Starting Create swap on /dev/zram0...
Nov 04 17:56:39 heidr zram-generator[3940]: Setting up swapspace version 1, size = 15.7 GiB (16832524288 bytes)
Nov 04 17:56:39 heidr zram-generator[3940]: LABEL=zram0, UUID=9e017c9a-fc01-4425-8f6e-f880815a2d2f
Nov 04 17:56:39 heidr systemd-makefs[3939]: /dev/zram0 successfully formatted as swap (label "zram0", uuid 9e017c9a-fc01-4425-8f6e-f880815a2d2f)
Nov 04 17:56:39 heidr systemd[1]: Finished Create swap on /dev/zram0.

checked that the device exists:

$ zramctl
NAME       ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo-rle      15.7G   4K   80B   12K      32 

but there's no swap on it:

$ swapon -s
$

Do I need to do anything else to actually use it?

lnicola commented 1 year ago

Sorry, it seems I can't read :pensive:. I need to do systemctl start /dev/zram0 instead, of course.