Solved

How to automate the swap size as per RAM

Posted on 2014-07-31
4
475 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 61

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now