diff options
author | Simon Rettberg | 2014-01-29 17:11:46 +0100 |
---|---|---|
committer | Simon Rettberg | 2014-01-29 17:11:46 +0100 |
commit | 2fb4d43cce5f030ea81e68b9b6ebb1b40ea0e7e2 (patch) | |
tree | d258373cdd5dad119b718567bba756dfa032fd27 /remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions | |
parent | [xorg] fixes for Xsession (thx ssc) (diff) | |
download | tm-scripts-2fb4d43cce5f030ea81e68b9b6ebb1b40ea0e7e2.tar.gz tm-scripts-2fb4d43cce5f030ea81e68b9b6ebb1b40ea0e7e2.tar.xz tm-scripts-2fb4d43cce5f030ea81e68b9b6ebb1b40ea0e7e2.zip |
[rfs-stage32] Speed up mounting tmp-partition and setting up zram swap
Diffstat (limited to 'remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions')
-rwxr-xr-x | remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions index 362e8f14..ca7317d4 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions @@ -37,7 +37,7 @@ diskfm () { found=yes case "mkfs.$fs" in mkfs.xfs) - fopt="-f" + fopt="-f -b size=4k -s size=4k -l size=512b" # fastest formatting possible :) mopt="-o noexec" ;; mkfs.ext2) @@ -109,7 +109,7 @@ cat "/etc/disk.partition" HAVE_SWAP=no for hdpartnr in $(sed -n -e "/ 82 /p" "/etc/disk.partition" | sed -e "s/[[:space:]].*//"); do echo -e "$hdpartnr\tswap\t\tswap\t\tdefaults\t 0 0" >> "/etc/fstab" - swapon "$hdpartnr" -p 10 && HAVE_SWAP=yes + swapon "$hdpartnr" -p 10 && HAVE_SWAP=yes # low priority, in case we have zram swap, prefer that) done # We use special non assigned partition type (id44) for harddisk scratch @@ -167,27 +167,5 @@ if [ "$HAVE_SWAP" = "no" ]; then slxlog "partition-swap" "Have no (formatted) swap partition, using zram swap only!" "/etc/disk.partition" fi -# Add zram swap -[ "$(uname -r)" == "3.8.13.8-openslx" ] && exit 0 -CPUS=$(grep -c -E "^processor.*[0-9]+$" /proc/cpuinfo) -if [ -z "$CPUS" ]; then - echo "ERROR: Could not determine CPU core count" -else - [ "$CPUS" -gt "16" ] && CPUS=16 # zram can only handle up to 32 devices, the system can apparently even just handle 29 swap partitions, so use a reasonable upper limit - if ! modprobe zram "num_devices=$CPUS"; then - echo "ERROR: Could not load zram module" - else - TOTAL=$(grep ^MemTotal /proc/meminfo | awk '{print $2}') - USE=$(( $TOTAL / ( 2 * $CPUS ) )) - echo "Have $CPUS cores, $TOTAL kb mem, use $USE kb zram swap per core" - USE=$(( $USE * 1024 )) - DEV=0 - while [ "$DEV" -lt "$CPUS" ]; do - echo "$USE" > "/sys/block/zram${DEV}/disksize" - mkswap "/dev/zram${DEV}" - swapon "/dev/zram${DEV}" -p 1000 - DEV=$(( $DEV + 1 )) - done - fi -fi +exit 0 |