You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
667 B

  1. ### BEGIN INIT INFO
  2. # Provides: zram
  3. # Required-Start: $local_fs
  4. # Required-Stop: $local_fs
  5. # Default-Start: S
  6. # Default-Stop: 0 1 6
  7. # Short-Description: Use compressed RAM as in-memory swap
  8. # Description: Use compressed RAM as in-memory swap
  9. ### END INIT INFO
  10. SIZE=2000000000
  11. case "$1" in
  12. start)
  13. modprobe zram num_devices=1
  14. echo $SIZE > /sys/block/zram0/disksize
  15. mkswap /dev/zram0
  16. swapon /dev/zram0 --priority 10
  17. ;;
  18. stop)
  19. swapoff /dev/zram0
  20. modprobe --remove zram
  21. ;;
  22. *)
  23. echo "Usage: $(basename $0) (start | stop)"
  24. exit 1
  25. ;;
  26. esac
  27. true