In Azure to create a swap file in the directory that's defined by the ResourceDisk.MountPoint parameter, you can update the /etc/waagent.conf file by setting the following three parameters:
Note The xx placeholder represents the desired number of megabytes (MB) for the swap file.
Restart the WALinuxAgent service by running one of the following commands, depending on the system in question:
Run one of the following commands to show the new swap apace that's being used after the restart:
If the swap file isn't created, you can restart the virtual machine by using one of the following commands:
ResourceDisk.Format=y
ResourceDisk.EnableSwap=y
ResourceDisk.SwapSizeMB=xx
Note The xx placeholder represents the desired number of megabytes (MB) for the swap file.
Restart the WALinuxAgent service by running one of the following commands, depending on the system in question:
Ubuntu: service walinuxagent restart
Red Hat/Centos: service waagent restart
Run one of the following commands to show the new swap apace that's being used after the restart:
dmesg | grep swap
swapon -s
cat /proc/swaps
file /mnt/resource/swapfile
free| grep -i swap
If the swap file isn't created, you can restart the virtual machine by using one of the following commands:
shutdown -r now
init 6