Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to automate the swap size as per RAM

Posted on 2014-07-31
4
Medium Priority
?
509 Views
Last Modified: 2014-08-18
Hi All,

My motive is to automate the process of creating swap twice of Physical RAM during OS installation .
If its not possible during oS installation then a post installation script or commands can be usefule - please help?
0
Comment
Question by:apunkabollywood
  • 2
4 Comments
 
LVL 25

Expert Comment

by:Zephyr ICT
ID: 40231369
Did you try using the "recommended" option?

as in:
 logvol swap --recommended --fstype swap --name=LogVol00 --vgname=VolGroup00

Open in new window


According to the docs: The minimum size of the automatically-generated swap partition is no smaller than the amount of RAM in the system and no larger than twice the amount of RAM in the system.

If you want more control you'll need to create something I think ...
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 40231404
The twice rule is old rule , and the new  rule is suggested at this site
http://www.cyberciti.biz/tips/linux-swap-space.html

You can try this example code for  create and remove swap script at this stie
http://programmaticponderings.wordpress.com/2013/12/19/scripting-linux-swap-space/

Hope understand your question completely.If not, pls pt it out


Duncan
0
 
LVL 62

Expert Comment

by:gheist
ID: 40231481
You need some swap like gigabyte to have indication when you run out of memory
And you can resize swap logical volume with LVM if your system really goes into crashing.
0
 
LVL 25

Accepted Solution

by:
Zephyr ICT earned 2000 total points
ID: 40231508
If you want to control the swap creation during kickstart you could also opt for a "scripted" way.

Define a %pre section in the kickstart file containing following:

%pre
 #!/bin/sh
 mem=$((`grep MemTotal: /proc/meminfo | sed ‘s/^MemTotal: *//’|sed ‘s/ .*//’` / 1024))
 echo “logvol swap –fstype swap –name=LogVol01 –vgname=VolGroup00 –size=$mem” > /tmp/setswap

Open in new window


Then set the %include around the part where you create the partitions:

%include /tmp/setswap

Open in new window


Fyi, I've tested the code on a Centos.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month11 days, 6 hours left to enroll

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question