mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-03 01:29:33 +00:00
if the NVMe partition was already formatted as "swap" then the service script would refuse mounting it; it would only format and mount a partition with an empty FS_TYPE. This causes such an instance to come up with only the 6GB swapfile swap which causes the Java VM launched with excessive amounts of heap space to simply crash
27 lines
1.2 KiB
Bash
Executable File
27 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Script to deploy on an instance that has an ephemeral volume as /dev/nvme0n1 (adjust env var EPHEMERAL_VOLUME if different)
|
|
# Ensures the partition is xfs-formatted, any existing partition contents will be overwritten if formatted otherwise.
|
|
# An existing xfs partition will be left alone.
|
|
. imageupgrade_functions.sh
|
|
EPHEMERAL_VOLUME_NAME=$(identify_suitable_partition_for_ephemeral_volume)
|
|
if [[ -n "${EPHEMERAL_VOLUME_NAME}" ]]; then
|
|
EPHEMERAL_VOLUME=/dev/${EPHEMERAL_VOLUME_NAME}
|
|
if awk '{print $1;}' /proc/mounts | grep "${EPHEMERAL_VOLUME}"; then
|
|
echo "Partition ${PARTITION} already mounted; not formatting/mounting volume"
|
|
else
|
|
FSTYPE=$(blkid -p $EPHEMERAL_VOLUME -s TYPE -o value)
|
|
if [ "$FSTYPE" = "" ]; then
|
|
echo FSTYPE was empty, creating swap partition
|
|
mkswap $EPHEMERAL_VOLUME
|
|
swapon --priority 2 -a $EPHEMERAL_VOLUME
|
|
elif [ "$FSTYPE" = "swap" ]; then
|
|
# it already is formatted as swap, so we can just use it
|
|
swapon --priority 2 -a $EPHEMERAL_VOLUME
|
|
else
|
|
echo "FSTYPE was $FSTYPE, not touching"
|
|
fi
|
|
fi
|
|
else
|
|
echo "No ephemeral partition found. Not creating any swap partition."
|
|
fi |