I want to add a swapfile of 2GB to my system. I have found this code for that
sudo fallocate -l 2g /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
As I have never used swapfile or swapspace. I want to know at what location a swapfile is created. Will the file be created in the home directory? What is the best location to create a swapfile? Home directory, root directory or other mounted disks?