Solved

How to automate the swap size as per RAM

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
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…
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…

746 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

12 Experts available now in Live!

Get 1:1 Help Now