So we have set up a system, but we have forgotten about the swap partition - did we start everything from scratch? Absolutely not. The swap in the file will also be good, and sometimes even better (it is always possible to increase its volume). All we need is this file, activating it as an exchange system, adding to /etc/fstab. Nothing could be simpler.
Create an exchange file
dd if=/dev/zero of=/extraswap bs=1M count=1024
The above will create 1GB file (1M * 1024)
We are improving access rights
chmod 600 /extraswap
We initialize it as a swap
Make sure that it works
Add permanently to /etc/fstab
sh -c 'echo "/extraswap swap swap defaults 0 0" >> /etc/fstab'
Yes, just that’s it. From this moment we do not have to combine it with separate partitions, we can at any time enlarge/reduce the created exchange space (dd command).