Setting Up Swap Without Actual Swap Partition in Ubuntu 10

I urgently needed Swap space but i hadn’t created a swap partition before. Then I Googled about the problem and found a useful solution which allowed me to add swap space without the need of creating swap partition.

1. First, create a large empty file:

sudo dd if=/dev/zero of=/swap_file bs=1M count=1000

Replace 1000 with the size of the swap file desired, in MB. You can also put the swap_file in a different location if desired.