Custom Partion table error


#1

Hello,

I am able to provision the hosts in expected way but when I define custom partition(disk layout) host provisioning getting failed with the below error and I am defining the partitions in the following…can you please let me know what I am missing

Error:
Kickstart command zerombr does not take any arguments.

Defined partition table like below:

#Dynamic - this line tells Foreman this is a script rather then a static layout
#This snippets define the swap partition size, it would generate a partition twice the size of the memory if your physical memory is up to 2GB
#or will create a swap partition with your memory size + 2GB.

#get the actual memory installed on the system and divide by 1024 to get it in MB
act_mem=$((`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 [ "$act_mem" -gt 2048 ]; then
    vir_mem=$(($act_mem + 2048))
else
    vir_mem=$(($act_mem * 2))
fi

#copy all the HDD partitions to the temp file for execution
cat <<EOF > /tmp/diskpart.cfg
zerombr yes
clearpart --all --initlabel
part swap --size "$vir_mem" 
part /boot --fstype xfs --size 100 --asprimary
part / --fstype xfs --size 1024 --grow
part /var --fstype xfs --size 1024 --grow
EOF

#2

Hi,
looking at an example, there is zerombr, not zerombr yes. I would try to change that to see if it helps. Seems like the variant you have has been deprecated on el5.


#3

On the same note, it’s not practical on todays servers to do swap as twice of amount of RAM anymore.

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/ch-swapspace

Here is a bit from Anaconda installer:

    474     if mem < 2048:
    475         swap = 2 * mem
    476 
    477     elif 2048 <= mem < 8192:
    478         swap = mem
    479 
    480     elif 8192 <= mem < 65536:
    481         swap = mem / 2
    482 
    483     else:
    484         swap = 4096

If you going to implement this caluculation in shell, please contribute your template I’d be interested.