Linux operation swap Partition

Source: Internet
Author: User

Swap is the swap partition under Linux, similar to the virtual memory of windows, when the physical memory is low, the system can put some memory of infrequently used programs into swap, to solve the situation of physical memory shortage.

If the swap space created by the system installation is too small, you can create swap files manually.

First, create a file
DD If=/dev/zero OF=KWXGD bs=1024 count=1024000

SSH executes the above command to create a 1G empty file named Kwxgd (write 0 to occupy the disk).

Second, make the swap file
Mkswap KWXGD

SSH executes the above command, the generated KWXGD is made into swap files, if you do not make swap files, the next step may appear: "Swapon:kwxgd:read swap header failed:invalid argument" error.

Third, the swap file to enter into force
Swapon KWXGD

SSH executes the above command so that the "KWXGD" swap file takes effect and is superimposed into the current SAWP space.

Iv. View Current Swap
Swapon-s

SSH executes the above command to see the current swap situation.

V. Automatic mounting 1) Edit/etc/fstab
Vi/etc/fstab
2) fill in by format
/ROOT/KWXGD   swap    swap    defaults      0    1

6 Delete swap partition 1) Use the Swapoff command to retract the swap space.
/usr/sbin/swapoff Swapfile
2) Edit the/etc/fstab file to remove the entity from this swap file. 3) Reclaim this file from the file system.
#rm Swapfile

Linux operation swap Partition

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.