The swap partition SWAP swap partition is an extension of computer physical memory. It is likely that you created a swap partition when you initially set it. You can use the following command to license the size of the available swap space in your system: CAT / Proc / Meminfo
You can have several swap partitions. [The old Linux kernel limits the size of each exchange partition, which can reach 124 MB, but Linux kernels 2.2.x or later, this limit is to create and enable a swap partition: Create an appropriate size with FDisk Partition (partition type 82, "Linux Swap"). Format the partition, check the damaged block, for example: mkswap -c / dev / hda4 you want to use your own partition name instead / dev / hda4. Because I don't specify the size of the partition, the system is automatically monitored. Enable switch partitions, for example: Swapon / DEV / HDA4 enables automatic enabling when the switch partition is started, you have to include appropriate portals in the / etc / fstab file, such as / etc / fstab, for eXample: / dev / hda4 SWAP SWAP Defaults 0 0
If you need to disable the exchange partition, you (as a superuser): swapoff / dev / hda4
Exchange file
Exchange files are usually slower than the exchange partition, so this is not a permanent recommendation. However, if you temporarily need more swap space, create a swap file can be installed quickly. You can have up to 8 exchange files, each file up to 16MB. Here is the step of generating a swap file: - Create a swap file indicating the size: DD if = / dev / zero of = / swapfile bs = 1024 count = 8192
(/ Dev / zero file represents a device file that always outputs 0, using it to get a full-time file. So you can use to create a new file and clear the old file in a coverage.)
This physically creates a swap file / swapfile, block size 1024 bytes, and the file contains 8192 blocks, with a total size of approximately 8 MB. [DD command copies the file. In the above example, the input file (IF) is / dev / zero, the output file (OF) is / swapfile. You cannot use the CP (Copy) command to copy the file because the exchange file is physically continuous on the hard disk. - Set the file with the following command: MKSWAP / SWAPFILE 8192 - Send the following command to force the content of the cache to write to the hard drive: SYNC- Enable the exchange file: swapon / swapfile When you use the exchange file, you turn off and remove it.
SWAPOFF / SWAPFILERM / SWAPFILE