Enabling swap on Ubuntu Core
Ubuntu Core images come with everything needed to enable swap, but it’s disabled by default. To enable it:
SIZEto a non-zero value.
sudo systemctl enable --now swapfile.service
That’s all that’s needed.
Now some more details:
/etc/default/swapfileis writable, but some editors might be confused by its directory being readonly. The provided
viis fine with it though.
SIZEis zero, even if the service is enabled and started, no swapfile is created (see the
/usr/bin/mkswapfileshell script for details).
- If you set
FILEto something on a different partition, you should add an appropriate
After=to the service file.
- To add that
systemctl daemon-reloadbefore you enable and start the service.
Last updated 11 months ago. Help improve this document in the forum.