Note extended hard disk and swap Partition

Source: Internet
Author: User
Note: Expand the hard disk and swap partition-Linux Enterprise Application-Linux server application information. The following is a detailed description. Today, the project's server crash has caused me to rush to downtown office early in the morning. Coincidentally, today, the PATH of New York is free of charge. It is a sigh of relief for the Shanghai Metro. When can the Shanghai Metro be free for one day? Go to the company, check the machine, and find that the home disk space is insufficient. The memory peak exceeds the physical memory limit until the machine crash. There is no way to expand the storage space. If I thought that 32 GB of memory was enough, I would not divide a lot of swap space. Who knows that as the number of projects increases, the memory of machines becomes a bottleneck. After finding the problem, just do it. Expand the hard disk space of GB in the/home directory first:

Lvextend? L + 200G/dev/vg-group00/Vg-Group005

Resize2fs/dev/vg-group00/Vg-Group005

Next, expand the swap partition:

Dd if =/dev/zero of =/home/swap bs = 1024 count = 51200000 // 50 GB or so

Mkswap/home/swap

Swapon/home/swap // swapoff/home/swap to stop

Finally, write the startup information of the swap file to the/etc/fstab file:

/Home/swap defaults 0 0

Now, if someone suddenly uses more than 10 Gb of memory, the system will not crash easily. Haha.

Run the free command to check whether there is 50 GB of virtual memory. If more than a dozen of you submit 10 Gb of data, the machine will not crash.
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.