Skip to content

Instantly share code, notes, and snippets.

@slackingfred
Created July 21, 2024 15:14
Show Gist options
  • Save slackingfred/c3058270a0fa53fe97e9ca773d28656f to your computer and use it in GitHub Desktop.
Save slackingfred/c3058270a0fa53fe97e9ca773d28656f to your computer and use it in GitHub Desktop.
Systemd config to create swap file in Azure ephemeral volume (B1s and some other instance types, but not all) -- adapted from zram.service
[Unit]
Description=Swap with ephemeral volume
After=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=true
ExecStartPre=/bin/fallocate -l 2560M /mnt/Win386.swp
ExecStartPre=/bin/chmod 0600 /mnt/Win386.swp
ExecStartPre=/sbin/mkswap /mnt/Win386.swp
ExecStart=/sbin/swapon /mnt/Win386.swp
ExecStop=/sbin/swapoff /mnt/Win386.swp
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment