CentOS Add swap partition

Source: Internet
Author: User

1. Create a swap partition with the DD command

DD If=/dev/zero of=/swapfile bs=1024 count=1024k

Next, you need to format the new swap partition

Mkswap/swapfile

The results are similar:

2. Open the Swap partition:

Swapon/swapfile

To close the swap partition, perform the Swapoff/swapfile

3. Check that the swap information is correct

Swapon-s

Then in the execution free-m see if the swap partition expands

4. Setting up boot from boot There are two places you can join the start command

(a) is written/etc/rc.local

Vi/etc/rc.local

Add Swapon/swapflie at the end

(b) is written in/etc/fstab

Vi/etc/fstab

At the end of the file, add
/swapfile Swap swap default 0 0

CentOS Add swap partition

Related Article

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.