Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 46 lines (37 sloc) 1.14 KB
#!/bin/bash
if [ ! -e /root/firstboot_done ]; then
touch /root/firstboot_done
if [ -e /root/firstboot.sh ]; then
/root/firstboot.sh
fi
fi
/sbin/modprobe zram num_devices=5
# 1 zram device per CPU
ZRAM_SWAP_SIZE=128
/bin/echo $((${ZRAM_SWAP_SIZE}*1024*1024)) > /sys/block/zram0/disksize
/sbin/mkswap /dev/zram0
/sbin/swapon -p 10 /dev/zram0
/bin/echo $((${ZRAM_SWAP_SIZE}*1024*1024)) > /sys/block/zram1/disksize
/sbin/mkswap /dev/zram1
/sbin/swapon -p 10 /dev/zram1
/bin/echo $((${ZRAM_SWAP_SIZE}*1024*1024)) > /sys/block/zram2/disksize
/sbin/mkswap /dev/zram2
/sbin/swapon -p 10 /dev/zram2
/bin/echo $((${ZRAM_SWAP_SIZE}*1024*1024)) > /sys/block/zram3/disksize
/sbin/mkswap /dev/zram3
/sbin/swapon -p 10 /dev/zram3
# and a real swap of 2Gb
if [[ ! -f /swapfile ]]; then
dd if=/dev/zero of=/swapfile bs=1M count=2000
chmod 600 /swapfile
fi
/sbin/mkswap -f /swapfile
/sbin/swapon -p 1 /swapfile
ZRAM_DOCKER_SIZE=400
/bin/echo $((${ZRAM_DOCKER_SIZE}*1024*1024)) > /sys/block/zram4/disksize
/sbin/mkfs.ext4 -O ^has_journal -N 200000 -I 128 /dev/zram4
mount /var/lib/docker
# no debug by default
umount /sys/kernel/debug
systemctl start docker
exit 0