How to make Swap

Source: Internet
Author: User
Tags uuid

Question review:

Today in compiling PHP fileinfo This module, the memory space of less than 1G error, and then check the memory size with free-m , a look and less than 150M


1, our company all uses is Aliyun the ECS instance, this is our use environment

2, the way to compile the PHP module see my blog (and compile memcache and other modules are the same method)

Swap production process:

1, create a large 2G file

[root@iz23hh6yk41z www]# dd if=/dev/zero of=/home/www/swapfile bs=1m count=2048

2. Format into swap

[root@iz23hh6yk41z www]# mkswap/home/www/swapfile

Setting up Swapspace version 1, size = 2097148 KiB

No label, uuid=7073e823-8f8c-476a-90c2-414383f15457


[root@iz23hh6yk41z www]# file Swapfile

Swapfile:linux/i386 swap file (new style), version 1 (4K pages), size 524287 pages, no label, uuid=7073e823-8f8c-476a-90c 2-414383f15457

3, open swap

[root@iz23hh6yk41z www]# swapon/home/www/swapfile

Swapon:/home/www/swapfile:insecure permissions 0644, 0600 suggested.

4. Mount

4.1 [root@iz23hh6yk41z www]# echo "uuid=7073e823-8f8c-476a-90c2-414383f15457 swap defaults 0 0" >>/etc/fs tab

Note: It is best to select the UUID when mounting, which is the unique identification of the device

4.2 Ways to view device UUID:

[root@iz23hh6yk41z ~]# blkid/home/www/swapfile

/home/www/swapfile:uuid= "7073e823-8f8c-476a-90c2-414383f15457" type= "swap"

4.3 Put the mounted equipment into effect immediately

[root@iz23hh6yk41z www]# mount-a

5, recompile php FileInfo module

Compiling methods See my blog:

To see if the module compiles successfully:/usr/local/php/bin/php-m | grep FileInfo

6, view the memory situation

[root@iz23hh6yk41z ~]# free-m

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: 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.