Web lists-archives.com

Re: How to use zram ?




On 09/28/2017 11:56 AM, tomas@xxxxxxxxxx wrote:
On Thu, Sep 28, 2017 at 11:47:56AM +0200, Pierre Couderc wrote:
I have found no howto for zram under debian,  nor even the word
"zram" in the archives of this list !

I have tried to use zramctl but it refuses with :

root@nous:~# zramctl --find --size 1024M
zramctl: no free zram device found

I suppose I should init something somewere, but what ?

On the contrary ubuntu has a dedicated zram-config to make the job.

Thanks for any help.
I didn't even know what it is -- but the zram(8) man page and a little
guesswork at least leads in some direction.

I assume you'd want to load the zram kernel module (sudo modprobe zram,
I'd guess) to be in in the fun.

There's some doc about the Linux kernel module itself (just follow the
link in the above man page).

Let us know how it works out and... make a backup first!


Thank you very much. I have not found "the zram(8) man page "... But It seems to work :

root@nous:~# modprobe zram num_devices=2
root@nous:~# zramctl --find --size 1024M
/dev/zram0
root@nous:~# zramctl --find --size 1024M
/dev/zram1
root@nous:~# free -th
              total        used        free      shared buff/cache   available
Mem:           3.8G         73M        3.6G        5.5M 146M        3.5G
Swap:            0B          0B          0B
Total:         3.8G         73M        3.6G
root@nous:~# mkswap /dev/zram0
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=66e3aa01-a4b8-4308-b317-608c6a072810
root@nous:~# free -th
              total        used        free      shared buff/cache   available
Mem:           3.8G         73M        3.6G        5.5M 146M        3.5G
Swap:            0B          0B          0B
Total:         3.8G         73M        3.6G
root@nous:~# swapon /dev/zram0
root@nous:~# free -th
              total        used        free      shared buff/cache   available
Mem:           3.8G         73M        3.6G        5.5M 147M        3.5G
Swap:          1.0G          0B        1.0G
Total:         4.8G         73M        4.6G
root@nous:~# mkswap /dev/zram1
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=69b8070b-3b8d-4234-a773-a59812e54552
root@nous:~# swapon /dev/zram1
root@nous:~# free -th
              total        used        free      shared buff/cache   available
Mem:           3.8G         74M        3.6G        5.5M 147M        3.5G
Swap:          2.0G          0B        2.0G
Total:         5.8G         74M        5.6G
root@nous:~#

Now I suppose I shouls put that in a systemd script...

Thank you very much.

PC