First, you have to create a file of a predefined size with a predefined block size.
dd if=/dev/zero of=/swap bs=1024 count=2097152The statement above, creates a file named "swap" that is located in your root partition ("/") with the block size of 1024 KB which has the overall size of 2 GB (2097152 KB = 1024 KB * 2048).
Now you have to give the file the swap format using the command bellow.
You can test your new swap by activating it:
Hereby it is not necessary to reboot the machine and you can see whether the new swap space is available by executing the
Now, you have to tell your system to use the new swap space by adding the following line to the /etc/fstab:
/swap swap swap defaults 0 0Note:
You also may be interested in how to tune ext3 for performance or how to tune ext4 for performance.