Skip to content

Commit d17645f

Browse files
Merge pull request #252060 from originalnetadmin/patch-3
Update high-availability-guide-suse.md
2 parents d315564 + 4e2cecb commit d17645f

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

articles/sap/workloads/high-availability-guide-suse.md

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -272,27 +272,45 @@ The following items are prefixed with either **[A]** - applicable to all nodes,
272272

273273
1. **[A]** Configure SWAP file
274274

275+
Create a swap file as defined in [Create a SWAP file for an Azure Linux VM](https://learn.microsoft.com/troubleshoot/azure/virtual-machines/create-swap-file-linux-vm)
275276
```bash
276-
sudo vi /etc/waagent.conf
277-
278-
# Check if property ResourceDisk.Format is already set to y and if not, set it
279-
ResourceDisk.Format=y
280-
281-
# Set the property ResourceDisk.EnableSwap to y
282-
# Create and use swapfile on resource disk.
283-
ResourceDisk.EnableSwap=y
284-
285-
# Set the size of the SWAP file with property ResourceDisk.SwapSizeMB
286-
# The free space of resource disk varies by virtual machine size. Make sure that you do not set a value that is too big. You can check the SWAP space with command swapon
287-
# Size of the swapfile.
288-
ResourceDisk.SwapSizeMB=2000
277+
#!/bin/sh
278+
279+
# Percent of space on the ephemeral disk to dedicate to swap. Here 30% is being used. Modify as appropriate.
280+
PCT=0.3
281+
282+
# Location of swap file. Modify as appropriate based on location of ephemeral disk.
283+
LOCATION=/mnt
284+
285+
if [ ! -f ${LOCATION}/swapfile ]
286+
then
287+
288+
# Get size of the ephemeral disk and multiply it by the percent of space to allocate
289+
size=$(/bin/df -m --output=target,avail | /usr/bin/awk -v percent="$PCT" -v pattern=${LOCATION} '$0 ~ pattern {SIZE=int($2*percent);print SIZE}')
290+
echo "$size MB of space allocated to swap file"
291+
292+
# Create an empty file first and set correct permissions
293+
/bin/dd if=/dev/zero of=${LOCATION}/swapfile bs=1M count=$size
294+
/bin/chmod 0600 ${LOCATION}/swapfile
295+
296+
# Make the file available to use as swap
297+
/sbin/mkswap ${LOCATION}/swapfile
298+
fi
299+
300+
# Enable swap
301+
/sbin/swapon ${LOCATION}/swapfile
302+
/sbin/swapon -a
303+
304+
# Display current swap status
305+
/sbin/swapon -s
289306
```
290307

291-
Restart the Agent to activate the change
308+
Make the file executable.
292309

293310
```bash
294-
sudo service waagent restart
311+
chmod +x /var/lib/cloud/scripts/per-boot/swap.sh
295312
```
313+
Stop and start the VM. Stopping and starting the VM is only necessary the first time after you create the SWAP file.
296314

297315
### Installing SAP NetWeaver ASCS/ERS
298316

0 commit comments

Comments
 (0)