1, free -m # to view the current swap partition size
2, create swapfile dd if = / dev / zero of = / swap_file bs = 1M count = 2000 # 2G copy disk space (Note: bs: large area size, count, total number of blocks)
2, to the swap space swapfile mkswap / swap_file # formatted swap partition
3, to enable swap space swapon / swap_file # open swap partition
4, free -m # confirm the swap partition size
5, vi / etc / fstab added in the file / swap_file swap swap default 0 0 # after the swap partition is boot size after the change
related to the command:
free --- view memory status command can display memory, swap, buffer cache, etc. The size and usage;
--- read dd, converts and outputs data command; sliced new partition the fdisk
mkswap --- set up swap
swapon --- enable the exchange zone, the equivalent mount
swapoff --- closes the exchange area, equivalent to umount
--- of: path and file name of the output of the exchange;
--- bs: block size in byte, i.e. typically 1k byte 1024;
--- count: Total number of blocks that is the total size of the space, i.e., in units of blocks K;
--- if: read source of free space