Azure - Add SWAP partition to a Linux VM

When you set up a Linux VM in Azure by default it does not contains a SWAP partition. You typically don't care until you start using Java applications =)

Adding a Linux SAP partition is really simple, here are the steps:

1. Edit the file /etc/waagent.conf
vi /etc/waagent.conf

2. Modify the configuration to match the following:
ResourceDisk.Format=y
ResourceDisk.EnableSwap=y
ResourceDisk.SwapSizeMB=10000
3. Save the file

4. Restart your system

That's it, try the "free" command and you will notice the swap values.


Comments