From the installation of the system has been exposed to this swap, the front also said it is similar to Windows virtual memory, partition when the general size of memory twice times, if your memory more than 4G, then you divide 8G seems to be unnecessary. 4 G is enough for daily exchange. However, there is also a case where virtual memory is not enough. If you do, do you want to re-split the disk? Of course not! Then we'll add a virtual disk.
The basic idea is to create a swapfile, format the swap format, and enable the virtual disk
#dd If=/dev/zero of=/tmp/newdisk bs=40k count=102400
Using DD to create a 4G file/tmp/newdisk out, where if represents the file from which to read,/dev/zero is a Linux-specific 0 generator, of which the output to which file, BS is the block size, count defines how many blocks.
#mkswap/tmp/newdisk
Mkswap This command is specially formatted for the swap format of the partition
#swapon/tmp/newdisk enable the virtual disk
Using the free command to view system memory and virtual memory usage, the-M option is viewed as M. You can see the current system. And Swapon is to enable our new swap file, enable and then use the free view found more than 400M.
#swapoff/tmp/newdisk
We can also close the enabled swap file with Swapoff.
Easy to use, artifact Ah
How to create a swap file