Web lists-archives.com

Re: How to use zram ?




On 09/28/2017 02:11 PM, David Baron wrote:

... 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
Did all this.
All my free -th results looked the same.
Could it be it was already there?

Assuming there is an advantage to this, how does one get it going on startup. 
I HAD a sysinit script for it at one time, before the new days of systend.

I have decided to use the following script and it seems to work :
git  clone https://github.com/Jiab77/systemd-zram
cd systemd-zram
./install.sh

You can the remove systemd-zram directory.

Here you can modify /etc/systemd/zram.conf from 33% to 50 for next reboot… But it is only to adopt the same policy as Ubuntu,  but the original prefers 33%...