Skip to content

systemd service that ensures a swapfile exists or is created on the volatile temporary drive in an Azure VM.

License

Notifications You must be signed in to change notification settings

soyfrien/makeswap-on-azure.service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deployment/Removal on ubuntu-20.04 .github/workflows/test-swapping20-04.yml

Animation showing installation, verification of functionality and removing of the makeswap-on-azure service.

Index

  1. Overview
  2. Usage

makeswap-on-azure.service

Ensures a swapfile exists or is created on the volatile temporary drive in an Azure VM.

Temporary disk

Every VM contains a temporary disk, which is not a managed disk. The temporary disk provides short-term storage for applications and processes and is intended to only store data such as page or swap files. Data on the temporary disk may be > lost during a maintenance event event or when you redeploy a VM. On Azure Linux VMs, the temporary disk is /dev/sdb by default and on Windows VMs the temporary disk is D: by default. During a successful standard reboot of the VM, the data on the temporary disk will persist.

Azure Disk Storage overview for Linux VMs

Usage

Install

Option A: Pre-packaged

wget -q https://github.com/ppdac/makeswap-on-azure.service/releases/latest/download/makeswap-on-azure.service.deb
sudo dpkg --install makeswap-on-azure.service.deb
sudo systemctl enable makeswap-on-azure.service
sudo systemctl restart makeswap-on-azure.service

Option B: From source

mkdir ~/git; cd ~/git

git clone https://github.com/ppdac/makeswap-on-azure.service.git
rm -rf ~/git/makeswap-on-azure.service/.git
rm -rf ~/git/makeswap-on-azure.service/.github

dpkg-deb --build ~/git/makeswap-on-azure.service
sudo dpkg --install ~/git/makeswap-on-azure.service.deb
sudo systemctl enable makeswap-on-azure.service
sudo systemctl restart makeswap-on-azure.service

rm -rf ~/git/makeswap-on-azure.service
rm ~/git/makeswap-on-azure.service.deb

Uninstall

sudo dpkg --remove makeswap-on-azure

Upgrade

  • Uninstall
  • Install

Adjust amount of virtual memory

The amount of virtual memory is dynamically determined, loosely based around the table on the Ubuntu SwapSize FAQ.

You can set your desired size at any time, by writing to this file /etc/makeswap-on-azure/swap_size.

For example:

echo "1G" > /etc/makeswap-on-azure/swap_size
sudo systemctl restart makeswap-on-azure.service

The value can be something like:

  • 8192K
  • 2048M
  • 1.5G

About

systemd service that ensures a swapfile exists or is created on the volatile temporary drive in an Azure VM.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages