Add swap partition to VPS

Source: Internet
Author: User
Tags vps

When installing AMH, the memory 121mb,swap swap partition is only 127MB, memory is too small to install, and then look for information on the Internet, found that can give Xen or KVM architecture of the VPS to add swap, the operation is very simple.

We'll use the DD command here, so let's take a look at the DD command parameters

DD command
Function: Copies the specified input file to the specified output file, and can be converted to format during the copy process. You can use this command to realize the function of the diskcopy command under DOS. First use the DD command to write the data on the floppy disk as a storage file, and then put the storage file into the second floppy disk, complete the function of diskcopy. It should be noted that the storage files on the hard disk should be removed with the RM command. The system defaults to using standard input files and standard output files.
Syntax: DD [Options]

if = input file (or device name).

of = output file (or device name).

ibs = Bytes Read bytes bytes at a time, that is, the number of bytes read into the buffer.

Skip = Blocks skips the Ibs*blocks block at the beginning of the read buffer.

Obs = bytes Writes bytes bytes At a time, that is, the number of bytes written to the buffer.

BS = bytes Sets the number of bytes in the read/write buffer (equal to setting IBS and OBS).

CBS = byte convert bytes byte at a time.

Count=blocks only copies the input blocks blocks.

Example

"Add Swap to VPS"

Typically only applies to Xen or KVM architecture VPS.

1, enter the catalogue

cd/var/

2, get a certain size of the file Block count=262144 (you can change the value as needed, that is, the increase in the size of swap):

DD If=/dev/zero of=swapfile bs=1024 count=262144

3. Create swap file Www.111cn.net

/sbin/mkswap Swapfile

4. Activate swap file

/sbin/swapon Swapfile

5, check swap is correct:

/sbin/swapon–s


6, add to the Fstab file to allow the system to boot when the automatic reference:

The echo "/var/swapfile swap defaults 0 0" >>/etc/fstab is added to the end of the file/etc/fstab.

OK, after reboot, free-m commands to see the increased swap partition.

Before adding:

Screenshot of command, add after swap free -m :

Conclusion

And then install the AMH Virtual Host management panel, well, display 121MB memory, 383MB swap space, Wood has a hint of memory error, directly into the installation options.

In fact, almost also a few m of memory, 128M memory KVM Architecture of this VPS, memory does not give enough.

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.