I got an email from an old friend earlier today asking me how to change ESX4 default COS memory to something else, for instance 800MB, and within a KickStart script!
When you do the change manually through the vCenter client, two files are modified in the background: /etc/vmware/ESX.CONF and /boot/grub/GRUB.CONF
To modify them whilst deploying ESX4 with a KS script, there is a great tool for that called SED (stream editor). It’s an editor used, not interactively on text files (like vi or emacs), but on streams. This allows it to transform text input from a pipe or the command line or a file (if it is piped to sed or given as an argument to sed).
Here is the code to include in your KS script:
#First we need to back up original files:
mv -f /etc/vmware/esx.conf /etc/vmware/esx.conf.orig
mv -f /boot/grub/grub.conf /boot/grub/grub.conf.orig
#Then we can edit the files:
sed -e ’s/boot\/memSize = \”272\”/boot\/memSize = \”800\”/g’ /etc/vmware/esx.conf.orig >> /etc/vmware/esx.conf
sed -e ’s/uppermem 277504/uppermem 819200/g’ -e ’s/mem=272M/mem=800M/g’ /boot/grub/grub.conf.orig >> /boot/grub/grub.conf
So basically SED searches for a certain strings; 272 and 277504, then replaces them with new values; 800 and 819200 et voila.
Happy KS scripting!