zRam is a virtual memory compression using block devices named /dev/zram using a fast compression algorithm (LZ4) that compress the least recently used (LRU) or inactive space in the memory allows the GNU/Linux kernel to free up more memory with less performance hit.
Create a zRam block devices
Load the zRam modules to the kernel using modprobe:sudo modprobe zramSet the zRam extremely fast compression algorithm using lz4:
sudo sh -c "echo 'lz4' > /sys/block/zram0/comp_algorithm"Set 2 Gigabyte available zRam disk space for swap:
sudo sh -c "echo '2G' > /sys/block/zram0/disksize"Create a swap on zRam block devices:
sudo mkswap --label zram0 /dev/zram0Enable the zRam block devices for swapping with high priority:
sudo swapon --priority 100 /dev/zram0
Automatically activate zRam swap at startup
Create a systemd service (zram.service) using a text editor such as nano:sudo nano /etc/systemd/system/zram.service
Add following to the zram.service:
[Unit] Description=zRam block devices swapping [Service] Type=oneshot ExecStart=/usr/bin/bash -c "modprobe zram && echo lz4 > /sys/block/zram0/comp_algorithm && echo 2G > /sys/block/zram0/disksize && mkswap --label zram0 /dev/zram0 && swapon --priority 100 /dev/zram0" ExecStop=/usr/bin/bash -c "swapoff /dev/zram0 && rmmod zram" RemainAfterExit=yes [Install] WantedBy=multi-user.targetEnable the zram.service to automatically run at startup:
sudo systemctl enable zram
Disable zRam block devices
To disable the zRam block devices swapping, run following commands:sudo swapoff /dev/zram0Remove the zRam module from the kernel:
sudo rmmod zramDisable the zram.service from automatically run at startup:
sudo systemctl disable zram.service
Спасибо !
ReplyDeleteThanks !
ReplyDeleteAmazing blog; I was confused about getting project opportunities through online platforms or app development companies near me. Your blog helped me locate these top sites, providing good development work. I also came across Eiliana.com
ReplyDeleteit is a new platform that provides good development work. Have a look at that platform too.