Before we begin, we can check if the system already has some swap space available. It is possible to have multiple swap files or swap partitions, but generally one should be enough.
We can see if the system has any configured swap by typing:
sudo swapon --show
If you don’t get back any output, this means your system does not have swap space available currently.
You can verify that there is no active swap using the
total used free shared buff/cache available Mem: 985M 84M 222M 680K 678M 721M Swap: 0B 0B 0B
As you can see in the Swap row of the output, no swap is active on the system.