Solved

How to automate the swap size as per RAM

Posted on 2014-07-31
4
483 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 500 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

828 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