diff options
Diffstat (limited to 'core/modules/disk-partitions/data/opt/openslx/scripts/systemd-setup_partitions')
-rwxr-xr-x | core/modules/disk-partitions/data/opt/openslx/scripts/systemd-setup_partitions | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/core/modules/disk-partitions/data/opt/openslx/scripts/systemd-setup_partitions b/core/modules/disk-partitions/data/opt/openslx/scripts/systemd-setup_partitions index 0325e519..c4346174 100755 --- a/core/modules/disk-partitions/data/opt/openslx/scripts/systemd-setup_partitions +++ b/core/modules/disk-partitions/data/opt/openslx/scripts/systemd-setup_partitions @@ -213,36 +213,15 @@ if [ -n "$DO_SWAP" ]; then # Check for standard swap partitions and make them available to the system HAVE_SWAP=no for PART_DEV in $(dev_find_partitions "82" "0657fd6d-a4ab-43c4-84e5-0933c84b4f4f"); do - if swapon "$PART_DEV" -p 10; then + if swapon -p 10 "$PART_DEV"; then HAVE_SWAP=yes # low priority, in case we have zram swap, prefer that echo -e "$PART_DEV\tswap\t\tswap\t\tdefaults\t 0 0" >> "/etc/fstab" fi done - # If swap is small/none, and we have a large enough thinpool ("MaxiLinux"), add swap there - # Determine non-zram swap size (KB) - disk_swap="$( gawk 'BEGIN{a=0} $1 ~ /^\/dev\// && $1 !~ /^\/dev\/zram/ {a+= $3} END{print a}' /proc/swaps )" - if (( disk_swap < 4096000 )) && [ -b "/dev/mapper/pool" ] \ - && [ "$( dmsetup table /dev/mapper/pool | awk '{print $3}' )" = "thin-pool" ]; then - pool_size="$( blockdev --getsize64 /dev/mapper/pool )" - pool_size=$(( pool_size / (1024*1024) )) # byte to mb - if (( pool_size >= 39000 )); then - thin_size=$(( ( pool_size - 30000 ) / 5 )) - (( thin_size > 16000 )) && thin_size=16000 # max 16GB - thin_size="$(( thin_size * 1000 * 2 ))" # to 512byte sectors - gettmp "logfile" - if ! dmsetup message "/dev/mapper/pool" 0 "create_thin 82" &> "$logfile"; then - slxlog --echo "partition-swap-thin" "Cannot create_thin for additional swap" "$logfile" - elif ! dmsetup create "thin-swap" <<<"0 $thin_size thin /dev/mapper/pool 82" &> "$logfile"; then - slxlog --echo "partition-swap-thin" "Cannot create thin device for additional swap" "$logfile" - elif ! mkswap "/dev/mapper/thin-swap" &> "$logfile"; then - slxlog --echo "partition-swap-thin" "Cannot mkswap on thin-swap" "$logfile" - elif ! swapon -dpages -p 9 "/dev/mapper/thin-swap" &> "$logfile"; then - slxlog --echo "partition-swap-thin" "Cannot swapon thin-swap" "$logfile" - else - echo "Added swap in thinpool" - HAVE_SWAP=yes # finally, success - fi - fi + if [ -b "/dev/mapper/slx-swap" ] && mkswap "/dev/mapper/slx-swap" \ + && swapon -p 10 "/dev/mapper/slx-swap"; then + echo "Added slx-swap in ID44" + HAVE_SWAP=yes # finally, success fi fi |