Azure Create a Swap partition
How to create a Swap partition on your VM
This applies to SFTP Gateway version 2.000.02.AZU
Along with the recommendation of the VM sizing guide, it is also a good idea to add a Swap partition to your VM. This gives you a soft memory ceiling, so Linux will not start terminating, what it deems as, non-essential processes when you run out of RAM.
First, run the top
command. Note that the Swap space is currently zero.
Then, run the following commands:
sudo /bin/dd if=/dev/zero of=/mnt/swap.1 bs=1M count=2048
sudo /sbin/mkswap /mnt/swap.1
sudo chmod 600 /mnt/swap.1
sudo /sbin/swapon /mnt/swap.1
echo "/mnt/swap.1 swap swap defaults 0 0" >> /etc/fstab
This creates a Swap partition that uses 2 GB of hard disk space. It also creates an entry in fstab
so the file system
change survives a reboot.
Run top
again, and you should see your Swap partition.
Finally, reboot and verify that your changes stick.
Once a swap partition is added, the 2GB of disk space used by the swap file is not longer available for normal use by the server.