Add and Release swap partitions

Source: Internet
Author: User

Swap partition

The swap partition frees up some of the space in the hard disk space when the system's physical memory is not available for use by the currently running program. The freed space may come from programs that have not been manipulated for a long time, and the freed space is temporarily saved to the swap partition until those programs are run and the saved data is restored to memory from the swap partition.

Simply put: The swap partition is a buffer in memory


In the work, sometimes encounter the swap partition alarm, indicating that swap is not enough, this situation occurs:

    1. First take a look at your memory is not enough, in many cases because the program consumes too much memory, or memory exposure caused by the need to restart the application, with the command top to view, and then press the M key, will be used in memory from high to low sorting

    2. Free-m See how big your swap partition is when the system is installed, if it is too small, resulting in a swap alarm, we need to add a swap partition, the steps to add a swap partition are:

      1. Create Swapfile

DD If=/dev/zero Of=/export/tmp/newdisk bs=4k count=102400

DD This command if you specify the source, generally is/dev/zero of where you want to put, Bs*count is the total space

bs*count=400m The total application is 400m

When applying for space, be sure to note that the size of the bs*count must be smaller than the size of the disk, or there will be problems

Format to swap format Mkswap-f/export/tmp/newdisk enable the virtual disk
SWAPON/EXPORT/TMP/NEWDISKD. Stop the virtual disk Swapoff/export/tmp/newdisk

Add and Release swap partitions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.