[Transfer] Alibaba Cloud ECS server CentOS6.5 adds swap partition

【Pro-test and easy to use! ] Add swap partition to Alibaba Cloud ECS server CentOS6.5

 Shell study notes   method SEO   release time: 2016-04-10 00:19 Sunday   506 views 1 comment Baidu has included      

Learning to install oracle database installation today, I found that my SWAP partition is too small and does not meet the requirements, so I want to expand the swap space, Baidu adds its own practice, the operation is as follows:

Create a swap partition using the dd command

[root@localhost Desktop]#dd if=/dev/zero of=/home/swap bs=1024 count=1048576

The calculation formula of count: count=SIZE*1024 (size is in MB)

This creates a /home/swap partition file with a size of 1G, and then needs to format the new SWAP partition:

[root@localhost Desktop]# mkswap /home/swap

 

Then use the swapon command to convert this file partition into a swap partition

[root@localhost Desktop]#swapon /home/swap
(The command to close the SWAP partition is: [root@localhost Desktop]#swapoff /home/swap)

 

Check it again with free -m, you can see that the swap has expanded.

 

In order to allow swap to mount automatically, modify the /etc/fstab file

vi /etc/fstab

add at the end of the file

/home/swap swap swap default 0 0

In this way, even if the system is restarted, the swap partition does not need to be manually mounted.

 

 

Article source: http://blog.chinaunix.net/uid-26881541-id-3347389.html

Please indicate: Method SEO Consultant  »  [Pro-test and easy to use! ] Add swap partition to Alibaba Cloud ECS server CentOS6.5

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326524520&siteId=291194637