Linux Increase swap partition

Source: Internet
Author: User

In the batch set up the environment, encountered after the completion of the environment found swap forget the situation, later Baidu, found the following method, the online may exist a lot of corresponding Post said this thing is relatively simple, the following is the results of their own practice, share to everyone.

1. View existing memory and swap
[Email protected] tmp]# free-m       total used free     shared    buffers     cachedmem:           7869        164       7705          0          7         -/+ buffers/cache:        108       7760Swap:            0           0          0
2. Create a 8G file with the DD command (8g=1024*1024*8=8388608)
if=/dev/xvda of=/var/swapfile bs=1024x768 count=83886088388608+0 in 8388608+0out8589934592 bytes (8.6318.562  27.0 MB/
3. Create it as a Linux swap virtual swap file
[[email protected] ~]# Mkswap/var//var/swapfile:warning:don't Erase Bootbits sectorson        whole disk. Use-18388604  kibno label, UUID=0a4afee0-20da-40d0-81a1-~]# swapon/ var/swapfile
4. You can use FREE-M to see the swap size and use swapon-s to view swap status
[Email protected] ~]# free-m total used free shared buffers Cachedmem:7869        167       7702          0          8          --/+ Buffers/cache: the       7758Swap:8191          0       8191[[Email protected]~]# Swapon-sfilename Type Size used priority/var/swapfile file8388600    0-1[[Email protected]~]#
5. Set the system startup to activate the virtual Exchange file automatically
[Email protected] ~]# vi/etc//var/swapfile           swap    defaults        0 0

Linux Increase 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.