Low memory

    How to increase the memory space in my system?

    Bitnami stacks for web applications install servers like Apache, MySQL, PostgreSQL and others. Some of them requires more than 1Gb of memory to work properly. If you have less than 1Gb of total memory you can do the following to increase it.

    - If you are using a Virtual Machine or a Cloud Image, it is possible to increase the RAM of your system

    - If you do not have swap space in your system, you can create a swap file for increasing the system memory space

    What is swap?

    Linux swaps allow a system to harness more memory than was originally physically available (RAM). Swap space is the area on hard disk that holds memory pages that are inactive, freeing up the physical memory for other uses.

    It is recommended to have swap space in your system. You can check your current swap space running the command "free". For example:

    $ free -m
                 total       used       free     shared    buffers     cached
    Mem:           491        144        346          0          2         25
    -/+ buffers/cache:        117        374
    Swap:          975         81        894

    In the example above, the machine has 419MB of RAM and 975MB for swap.

    How do I create a swap file?

    It's highly recommended that the swap space should be equal or bigger than the amount of physical memory (RAM). If you have less than 1Gb of memory,  it is recommended to create at least 1GB for swap. This section will cover how to create 1GB file for swap in your Linux system.

    Before creating the swap space, you can identify a partition onto which you can safely put the swap file. If you have an ephimeral partition, that is ideal for this.

    $ sudo dd if=/dev/zero of=/mnt/swap.0 bs=1024 count=1048576
    $ sudo mkswap /mnt/swap.0
    $ sudo su 

    Change to root user in the machine and run the following commands:

    root# echo "/mnt/swap.0 swap swap defaults 0 0" >> /etc/fstab
    root# swapon /mnt/swap.0

    You can check if swap space was properly enabled with the "free" command or the command below:

    $ sudo swapon -s
    Tag page (Edit tags)
    • No tags
    Page statistics
    15531 view(s), 11 edit(s) and 2227 character(s)


    You must login to post a comment.

    Attach file