Basic idea: Create a swapfile file--format to swap format--enable virtual disk.
Build Swapfile, size 1G
# dd If=/dev/zero of=/var/swapfile bs=10k count=102400
Description: Create a file of size 1G swapfile. "DD" This command,"If" specifies the source,/Dev/zero is an input device that initializes the file with it . "of" specifies the target file, "BS" defines the size of the block, "Count" defines the number of blocks, and these two parameters determine the target file size = bs x count.
2. Format the virtual memory file
# mkswap-f/var/swapfile
3. Activating virtual Memory files
# Swapon/var/swapfile
4. Set boot automatically mount virtual memory file
#vim/etc/fstab
Add code:
/var/swapfile swap swap defaults 0 0
This article is from the "qi" blog, please be sure to keep this source http://garany.blog.51cto.com/7342714/1774639
Linux increases virtual memory