Creating a swap file
The swap file is a
.imgfile to store the swap file
- Creating a directory to store the swap
mkdir /media/fasthdd
- Create the swap file
dd if=/dev/zero of=/media/fasthdd/swapfile.img bs=1024 count=1M
This will take a few seconds or minutes depending on the size.
This will create a 1GB swap
If you want a bigger swap, set the count number to like 4M for 4GB or 8M for 8GB
- Bake the swap
mkswap /media/fasthdd/swapfile.img

- Activate the swap
This will ensure that the file will be activated on boot. Edit the/etc/fstabfile
nano /etc/fstab
and add this below the default /swap.img
/media/fasthdd/swapfile.img swap swap sw 0 0
Optionally, you can comment that swap out.