[Unit] Description=Turn on swap [Service] Type=oneshot RemainAfterExit=true ExecStartPre=-/bin/bash -euxc ' \ fallocate -l 8192m /swap &&\ chmod 600 /swap &&\ mkswap /swap' ExecStart=/sbin/swapon /swap ExecStop=/sbin/swapoff /swap [Install] WantedBy=local.target