diff options
author | Dirk | 2013-03-19 18:37:15 +0100 |
---|---|---|
committer | Dirk | 2013-03-19 18:37:15 +0100 |
commit | 3ab7f117555d80951b026163b757c8992592f151 (patch) | |
tree | 62ae98ee17d20054246e6b07cddd883e8c4e9602 /data | |
parent | Should be added to systemd ... (diff) | |
download | tm-scripts-3ab7f117555d80951b026163b757c8992592f151.tar.gz tm-scripts-3ab7f117555d80951b026163b757c8992592f151.tar.xz tm-scripts-3ab7f117555d80951b026163b757c8992592f151.zip |
Stuff to activate swap ...
Diffstat (limited to 'data')
-rw-r--r-- | data/activate-swap.sh (renamed from data/activate-swap) | 25 | ||||
-rw-r--r-- | data/analyse-disk.sh | 2 |
2 files changed, 16 insertions, 11 deletions
diff --git a/data/activate-swap b/data/activate-swap.sh index 10cb42e9..edaad1f2 100644 --- a/data/activate-swap +++ b/data/activate-swap.sh @@ -9,22 +9,27 @@ # # General information about OpenSLX can be found under http://openslx.org # -# Initialize swap for OpenSLX linux stateless clients, both for swap on local -# disk partitions as well as compressed ramzswap or similar +# Initialize swap for OpenSLX linux stateless clients, first for swap as +# compressed RAM (zram) and then on local disk partitions, if detected by +# disk-analyse.sh script ############################################################################# -# depends on mount-disk.sh -# depends on availability of the appropriate kernel module/functionality +# Depends on analyse-disk.sh and on availability of the appropriate kernel +# module/functionality # try to enable compressed RAM SWAP / ZRAM -if modprobe ${MODPRV} ramzswap 2>/dev/null && [ -f /usr/bin/rzscontrol ] ; then - rzscontrol /dev/ramzswap0 --init - swapon /dev/ramzswap0 2>/dev/null - #hdswap="# disk swap disabled because of enabled compressed ramswap" -elif modprobe ${MODPRV} zram 2>/dev/null ; then +if modprobe -q zram 2>/dev/null ; then # assign a quarter of total mem to zram echo $(( $(free -k | awk '/^Mem:/ { print $2 }') * 256 )) > /sys/block/zram0/disksize mkswap /dev/zram0 2>/dev/null - swapon /dev/zram0 2>/dev/null + swapon /dev/zram0 1>/dev/null 2>/dev/null fi + +# add on-disk swap if available +for hdpartnr in $(cat /etc/fstab | sed -n -e "/swap.*swap/p"| \ + sed -e "s/[[:space:]].*//") ; do + mkswap ${hdpartnr} 2>/dev/null + swapon ${hdpartnr} 1>/dev/null 2>/dev/null +done + diff --git a/data/analyse-disk.sh b/data/analyse-disk.sh index ac63956e..908ee298 100644 --- a/data/analyse-disk.sh +++ b/data/analyse-disk.sh @@ -72,7 +72,7 @@ for hdpartnr in $(cat /etc/disk.partition | \ # check for supported filesystem and formatter ( if diskfm $hdpartnr ; then # echo "$hdpartnr is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready - echo -e "$hdpartnr\t/tmp\t\tauto\t\tdefaults\t 0 0" >>/etc/fstab + echo -e "$hdpartnr\t/tmp\t\tnoauto\t\tdefaults\t 0 0" >>/etc/fstab else echo "formatting failed for some reason ($(sysup))" >/tmp/tmpready fi ) & |