Just a little while ago we needed to add swap to our CoreOS VMs on Azure but we didn't find a straightforward instructions how to do that.
Hopefully, it will come handy for people that are searching for this ;)
Open waagent config file:
sudo vim /usr/share/oem/waagent.conf
add (or uncomment) lines
ResourceDisk.Format=y ResourceDisk.Filesystem=ext4 ResourceDisk.MountPoint=/mnt/resource ResourceDisk.EnableSwap=y ResourceDisk.SwapSizeMB=4096
and now restart waagent
sudo systemctl restart waagent
If you happened to follow this tutorial, you gonna have an unstable system that's prone to freezing. Don't do that.