Learn how to manually expand the SWaP partition size

Source: Internet
Author: User

In Linux, this virtual memory is called SWaP. When installing the operating system, the installation wizard prompts you how much SWaP space you need to create. When we install Oracle 10 Gb in Linux, we find that the SWaP partition is too small, and we need to manually expand the size of the SWaP partition. Here, we will learn how to expand SWaP partitions.

1. Create a partition

The following operations must be performed under the root user. First, create a partition and run the dd command, such

 
 
  1. dd if=/dev/zero of=/home/swap bs=1024 count=1024000 

This will create a partition file such as/home/swap. The file size is 1024000 blocks. Generally, 1 block is 1 K, so the space is 1024 MB.

2. Specify the partition type as SWaP partition.

Convert the partition into a SWaP partition. Run the mkSWaP command as follows:

 
 
  1. /sbin/mkswap /home/swap 

Then use the SWaP partition to make it valid.

 
 
  1. /sbin/swapon /home/swap 

Now, run the free-m command to check the memory and SWaP partition size, and we can see that the space is increased by MB.

3. Set the extended SWaP partition to auto mount

However, after the computer is restarted, it is found that SWaP is still so large, the new SWaP is not automatically started, and manual start is required.

Modify the/etc/fstab file and add the following line to automatically mount the command line:

 
 
  1. /home/swap swap swap defaults 0 0 

In this way, we have extended the SWaP partition. Hope everyone can learn.

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.