Http://blog.sina.com.cn/s/blog_6e4388910100tsk7.html
Swap is generally in a proprietary swap area, which may be because you are prompted to create a swap area when you install it . But virtually any file can be used as a swap ( swap device ), either as a partition or as a simple file. However, in order to better experience the effect and speed of induction, it is recommended to use a large amount of memory instead of relying on swap. You can add a swap file to increase the swap
A total of four steps
1) Create a file of your pre-set size.
2) format the file as swap ( swap device ).
3) Add the swap to the existing system.
4) make a permanent change in the system.
Example: To add a 512M swap
Create a 512M file
We will create a swap file on the/mnt/512mb.swap .
sudo dd if=/dev/zero of=/mnt/512mb.swap bs=1m count=512
The count=512 in the code means that we are going to create a file that contains a bs=1m (bs = block size chunk ; 1M=1mebibyte one megabyte =1048576 bytes bytes ) of the chunk. Be careful not to use the dd of=/mnt/512mb.swap bs=1m seek=512 count=0 this command. Although the file will grow to 512Mb immediately, it is vulnerable and may be unusable.
Format the file so that it becomes swap ( swap device ):
sudo mkswap/mnt/512mb.swap
Immediately activate swap to the existing system :
sudo swapon/mnt/512mb.swap
Now the new swap can be seen through the "cat/proc/meminfo" command.
Make a permanent change :
Edit /etc/fstab file :
Gksudo Gedit/etc/fstab
Add the following line to the end of the file :
/mnt/512mb.swap None swap SW 0 0
Save and restart.
Set up permanent swap swap space under Ubuntu System (reprint)