How to kickstart a system with a dynamic partition layout on Red Hat Satellite 6
Environment
- Red Hat Satellite 6
Issue
- How do I kickstart a system with a dynamic partition layout on Red Hat Satellite 6?
- I would like to customize the partitioning scheme in kickstart.
Resolution
-
In order to be able to use dynamic partition layouts, the partition template must have the string '#Dynamic' on its template. If the partition table template contains '#Dynamic' then the kickstart process will execute the text as a Bourne Shell (BASH) script as its very first step (%pre section) and will then include the file /tmp/diskpart.cfg into the downloaded kickstart file.
-
To create a new partition layout, you can follow
Hosts -> Partition Tables -> New Partition Tableon the Red Hat Satellite 6 webUI. -
The template below can be used as example to create a dynamic swap size (#Dynamic should be in the very first line):
#Dynamic
<%#
kind: ptable
name: Kickstart default
model: Ptable
oses:
- CentOS
- Fedora
- RedHat
%>
# get memory
ram_memory=$((`grep MemTotal: /proc/meminfo | sed 's/^MemTotal: *//'|sed 's/ .*//'` / 1024))
# check if the memory is less than 2GB then swap is double the memory else it is memory plus 2 GB
if [ "$ram_memory" -gt 2048 ]; then
swap_size=$(($ram_memory + 2048))
else
swap_size=$(($ram_memory * 2))
fi
cat << EOF > /tmp/diskpart.cfg
zerombr
clearpart --all --initlabel
part swap --size "$swap_size"
part /boot --size 1000 --asprimary
part pv.01 --size=1000 --grow
volgroup myvg pv.01
logvol / --vgname=myvg --name=rootvol --size=1000 --grow
EOF
There is a difference between #Dynamic and # Dynamic, there should not be any space between # and D.
- Once you save the partition template, you have to enable it on the desired "Operation System" by accessing:
Hosts -> Operating Systems -> <Select the Operating System> -> Partition Table -> <Dynamic Partition Layout Name>
- Just for example, the kickstart template should contain the snippets like below:
text
reboot
install
<%= @mediapath %>
lang en_US.UTF-8
[..SNIP..]
#-----START PARTITION LAYOUT-----------------
#partition layout
<% if @dynamic -%>
%include /tmp/diskpart.cfg
<% else -%>
<%= @host.diskLayout %>
<% end -%>
#-----END PARTITION LAYOUT-----------------
%packages --ignoremissing
yum
dhclient
ntp
wget
[...SNIP...]
## partition layout script
<% if @dynamic -%>
%pre
<%= @host.diskLayout %>
<%= section_end -%>
<% end -%>
[...SNIP...]
For more KB articles/solutions related to Red Hat Satellite 6.x Provisioning Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x Provisioning related Issues
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.