Add a Swap space in Linux

Source: Internet
Author: User
* *************************** Environment for adding Swap space in Linux: CentOS6.2author: youseesan ***************************** mkdir/var/swapwww.2cto.com --- create a specified size file. swp1024 bytes 65536/
* ***************************** Add an environment for Swap space in Linux: centOS 6.2 author: youseesan ******************************
Mkdir/var/swap www.2cto.com --- create file. swp 1024 byte 65536/1024 = 64 M [root @ localhost ~] # Dd if =/dev/zero of =/var/swap/file. swp bs = 1024 count = 65536 records 65536 + 0 read records 65536 + 0 write records
67108864 bytes (67 MB) copied, 1.05399 seconds, 63.7 MB/second [root @ localhost ~] # ---- UUID = 7b2d46b8-6448-43d5-86e0-fffa0c798965 as the volume label [root @ localhost ~] # Mkswap/var/swap/file. swp mkswap:/var/swap/file. swp: warning: don't erase bootbits sectors on whole disk. use-f to force. setting up swapspace version 1, size = 65532 KiB no label, UUID = 7b2d46b8-6448-43d5-86e0-fffa0c798965
Vi/etc/fstab -- add the following line. after the system starts, it automatically loads logs/var/swap/file. swp swap defaults 0 0 defaults www.2cto.com [root @ localhost ~] # Free-m total used free shared buffers cached Mem: 1266 364 901 0 17 181-/+ buffers/cache: 165 1100 2918 Swap: 2918 0 [root @ localhost ~] #
--- Enable swap to add [root @ localhost ~] # Swapon/var/swap/file. swp [root @ localhost ~] # Free-m total used free shared buffers cached Mem: 1266 364 901 0 17 181-/+ buffers/cache: 165 1100 2982 Swap: 2982 0 [root @ localhost ~] # Www.2cto.com --- disable swap to add [root @ localhost ~] # Swapoff/var/swap/file. swp [root @ localhost ~] # Free-m total used free shared buffers cached Mem: 1266 364 901 0 17 181-/+ buffers/cache: 165 1100 2918 Swap: 2918 0 [root @ localhost ~] #
 
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.