Advertisement
Guest User

How to enable zram

a guest
Mar 19th, 2022
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. sudo echo "zram" > /etc/modules-load.d/zram.conf
  2. sudo echo "zram num_devices=4" > /etc/modprobe.d/zram.conf
  3. Edit /etc/systemd/system/zram.service
  4. add
  5. [Unit]
  6. Description=Swap with zram
  7. After=multi-user.target
  8.  
  9. [Service]
  10. Type=oneshot
  11. RemainAfterExit=true
  12. ExecStartPre=zramctl -f -s 2500MiB -a lz4
  13. ExecStartPre=/sbin/mkswap /dev/zram0
  14. ExecStart=/sbin/swapon /dev/zram0
  15. ExecStop=/sbin/swapoff /dev/zram0
  16.  
  17. [Install]
  18. WantedBy=multi-user.target
  19.  
  20. Save and close
  21. Then sudo systemctl enable zram
  22. And then add to /etc/sysctl.conf
  23. vm.vfs_cache_pressure=500
  24. vm.swappiness=100
  25. vm.dirty_background_ratio=1
  26. vm.dirty_ratio=50
  27. Save and reboot.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement