Skip to content

Commit

Permalink
Create zram.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
don authored Dec 24, 2016
1 parent eccbdb3 commit a9ad7e2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions zram.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
modprobe zram num_devices=4

totalmem=`free | grep -e "^Mem:" | awk '{print $2}'`
mem=$(( ($totalmem / 4)* 1024))

echo $mem > /sys/block/zram0/disksize
echo $mem > /sys/block/zram1/disksize
echo $mem > /sys/block/zram2/disksize
echo $mem > /sys/block/zram3/disksize

mkswap /dev/zram0
mkswap /dev/zram1
mkswap /dev/zram2
mkswap /dev/zram3

swapon -p 5 /dev/zram0
swapon -p 5 /dev/zram1
swapon -p 5 /dev/zram2
swapon -p 5 /dev/zram3

0 comments on commit a9ad7e2

Please sign in to comment.