A auto swap file configured in a single systemd service.
- Copy the service into:
/etc/systemd/system/swapon.service
- Load the service:
systemctl enable /etc/systemd/system/swapon.service
- Start the service:
systemctl start swapon
Considerations before swapon:
- The file must be in a partition with enough space