From ac5ba52862a31ae9da83b325fa832cdebb3b90a1 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 12 Oct 2016 19:40:32 +0200 Subject: [rootfs/hwstats] Use 66% RAM as /tmp tmpfs instead of 60G so we can detect and report when running out of memory --- .../data/opt/openslx/scripts/cron-system_usage_update | 9 ++++++++- .../data/opt/openslx/scripts/systemd-setup_partitions | 8 ++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/remote/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update b/remote/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update index 74486508..ff5adc70 100755 --- a/remote/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update +++ b/remote/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update @@ -21,6 +21,13 @@ for SESSION in $(loginctl | awk '{print $1}'); do fi done +# Also report usage of /tmp and swap +TMP=$(df -P /tmp | grep -m1 ^/tmp) +TMP_SIZE=$(echo $TMP | awk '{print $2}') +TMP_FREE=$(echo $TMP | awk '{print $4}') +SWAP_FREE=$(grep -m1 ^SwapFree: /proc/meminfo | awk '{print $2}') + curl -s --data-urlencode "type=~runstate" --data-urlencode "uuid=$UUID" --data-urlencode "used=$USED" \ - --data-urlencode "user=$Name" "$SLX_REMOTE_LOG" > /dev/null 2>&1 + --data-urlencode "user=$Name" --data-urlencode "tmpsize=$TMP_SIZE" --data-urlencode "tmpfree=$TMP_FREE" \ + --data-urlencode "swapfree=$SWAP_FREE" "$SLX_REMOTE_LOG" > /dev/null 2>&1 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 0c352241..c8e680f0 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 @@ -152,9 +152,13 @@ done mount -a -# Make huge tmpfs if nothing could be mounted for /tmp +# Make tmpfs if nothing could be mounted for /tmp +# 2016-10-12: Use a sane size of 66% which should be generous enough and prevent the machine from +# just crashing if RAM is too full. We previously hugely oversized since vmware wants at least as +# much free space as the VMs RAM; however, this requirement can be disabled with a vmx setting, +# which we're now doing. if [ "$HAVE_TEMP" = "no" ]; then - mount_temp -t tmpfs -o size=60G none + mount_temp -t tmpfs -o size=66% none slxlog "partition-temp" "Running /tmp on tmpfs only!" "/etc/disk.partition" fi if [ "$HAVE_SWAP" = "no" ]; then -- cgit v1.2.3-55-g7522