Linux: Adding a Swap File
Written by rower on October 24, 2011 – 3:38 pm
Add a Linux swap file to improve system performance
By Robin Rowe
HOLLYWOOD, CA (MovieEditor.com) 10/24/2011 – If your Linux box freezes with a lot of tabs open in your web browser, a swap file may help. It used to be you had to dedicate a partition to swap, but now you can create a swap file. We’ll create an empty swap file, format it, activate it and add it to fstab so it will be activated automatically upon system boot.
# dd if=/dev/zero of=/swapfile bs=1024 count=2048000
# mkswap /swapfile
# swapon /swapfile
# vi /etc/fstab
Append this line to fstab:
/swapfile swap swap defaults 0 0