Skip to content

Instantly share code, notes, and snippets.

@KostyaEsmukov
Last active October 20, 2016 07:28
Show Gist options
  • Save KostyaEsmukov/7a10153f55c6e647a70642b207461e53 to your computer and use it in GitHub Desktop.
Save KostyaEsmukov/7a10153f55c6e647a70642b207461e53 to your computer and use it in GitHub Desktop.

Create a swapfile on Linux

dd if=/dev/zero of=/var/swapfile bs=1M count=2048
chmod 0600 /var/swapfile
mkswap /var/swapfile

swapon /var/swapfile

echo >> /etc/fstab
echo "/var/swapfile none swap sw 0 0" >> /etc/fstab

swap on Azure

http://msdn.microsoft.com/en-us/library/windowsazure/jj672979.aspx https://blogs.msdn.microsoft.com/mast/2013/12/06/understanding-the-temporary-drive-on-windows-azure-virtual-machines/

# ResourceDisk.Format=y
# ResourceDisk.Filesystem=ext4
# ResourceDisk.MountPoint=/mnt/resource

cat >> /etc/waagent.conf << EOF
ResourceDisk.EnableSwap=y
ResourceDisk.SwapSizeMB=2048
EOF

# CentOS
service waagent restart

# Ubuntu
service walinuxagent restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment