deepa,
u can add a swap file instead of swap partition which can b usedd on the root partition on anywhere on the disk where u can create this one. i m writing the steps 2 create the swap file in technical way:-
1.
Determine the size of the new swap file and multiple by 1024 to determine the block size. For example, the block size of a 64 MB swap file is 65536.
2.
At a shell prompt as root, type the following command with count being equal to the desired block size:
dd if=/dev/zero of=/swapfile bs=1024 count=65536
3.
Setup the swap file with the command:
mkswap /swapfile
4.
To enable the swap file immediately but not automatically at boot time:
swapon /swapfile
5.
To enable it at boot time, edit /etc/fstab to include:
/swapfile swap swap defaults 0 0
The next time the system boots, it will enable the new swap file.
6.
After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command cat /proc/swaps or free.
suppose if u want 2 create 512MB file in home folder then follow this one:-
dd if=/dev/zero of=/home/swapfile bs=1k count=512k
This creates a blank file called /home/swapfile which is 512 MB in size
# mkswap -f /home/swapfile
This creates a swap filesystem in the area occupied by /home/swapfile
# swapon /home/swapfile
This enables the space occupied by /home/swapfile to be used as a swap area.
Edit /etc/fstab and put an entry there so that this file will be mounted as swap on startup. man 5 fstab and man swapon for more info.