Manually create and delete SWAP files in LINUX

Source: Internet
Author: User

How to manually create and delete SWAP files in LINUX: 1. determine the size of the swap file, in MB. Multiply the value by 1024 to obtain the block size. For example, the block size of a 64 MB swap file is 65536. 2. at the root prompt, type the following command, where count is equal to the required block size: dd if =/dev/zero f =/swapfile bs = 1024 count = 655363. create a swap file: mkswap/swapfile4. open the swap file immediately instead of automatically enabling it at startup: swapon/swapfile5. to enable it at startup, add the following content to/etc/fstab: /swapfile swap defaults 0 0 the next time the system starts, the new swap file is opened. 6. After adding a new swap file and enabling it, check the output of cat/proc/swaps or the free command to check whether swap is enabled. 7. Delete SWAP partition swapoff/swapfile Modify/etc/fstab file rm-rf/swapfile 1 block = 512 bytes

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.