*** WARNING ***
Using Less Physical Memory will Impact the performance of the Image for every user. You are making a tradeoff.
*** WARNING ***
A few customers asked if they could use less memory/RAM to accomplish the same work. Yes, you can. There is a tradeoff. You sacrifice RAM/Processing performance for disk space.
The following code adds a new swapfile to your system. The file should address the gap between the recommended 8GB and the RAM you are removing from the recommended. 8G -> 4G – you should create a swap file of at least 4G.
To get the right size, you’ll have to edit the NUMBLOCKS. Example is 4G * 1024 * 1024 = 2097152 -> # of 1024 K Bytes. You’ll have to do the math for each of the different block sizes.
First, you should ssh to the system.
#!/bin/sh # createSwapFile.sh - Creates a SWAP File for the QuickStart # you can edit the NUMBLOCKS*BLOCKSIZE to match the desired RAM. # # Reference = NUMBLOCKS=2097152 BLOCKSIZE=1024 sudo dd if=/dev/zero of=/swapfile bs=${BLOCKSIZE} count=${NUMBLOCKS} sudo mkswap /swapfile2 sudo swapon /swapfile2
The link to the GitHub Gist is here.
Now that you have turned the swap file on, let’s add it permanently
sudo vim /etc/fstab Click the "I” key Use the Arrows to Navigate to the swapfile line Go to the End Click the Enter Key Paste /swapfile2 swap swap defaults 0 0 Click Escape Key Type wq!
You are all set with more memory applied to the system permanently.
References:
[1] https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Deployment_Guide/s2-swap-creating-file.html