Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • Partitioning problem with ks.cfg

    Posted on

    Hey all,

    I have a custom kickstart that I am using to partition out the hard drive based upon the size of the drive. If the drive is bigger than 250GB, then I want to partition out the drive one way and if the drive is smaller than that, then I want to partition out the drive another way. The code below works and correctly partitions the system based on the hard drive size:

    platform=x86, AMD64, or Intel EM64T

    %include /tmp/part-include

    version=DEVEL

    %pre

    !/bin/sh

    TOTAL=

    parted -s /dev/sda unit mb print free | grep Free | awk '{print $3}' | cut -d "M" -f1

    if [ $TOTAL -ge 256000]
    then
    #This set the minimum var partiton size to 150GB if the HD has more than 250GB
    let VAR_MIN_SIZE=153600
    #This set the minimum tmp partiton size to 20GB if the HD has more than 250GB
    let TMP_MIN_SIZE=20480
    else
    let VAR_MIN_SIZE=10240
    let TMP_MIN_SIZE=1024
    fi

    echo "# Clear the Master Boot Record" > /tmp/part-include
    echo "zerombr" >> /tmp/part-include
    echo "# Partition clearing information" >> /tmp/part-include
    echo "clearpart --all --initlabel" >> /tmp/part-include
    echo "# Disk partitioning information" >> /tmp/part-include
    echo "part / --fstype ext3 --grow --size=3968" >> /tmp/part-include
    echo "part /boot --fstype ext3 --size=128" >> /tmp/part-include
    echo "part /home --fstype ext3 --size=1024">> /tmp/part-include
    echo "part /var --fstype ext3 --grow --size=$VAR_MIN_SIZE" >> /tmp/part-include
    echo "part /tmp --fstype ext3 --grow --size=$TMP_MIN_SIZE" >> /tmp/part-include
    echo "part swap --fstype swap --size=2048" >> /tmp/part-include
    echo "part /var/log/audit --fstype ext3 --size=1024" >> /tmp/part-include
    echo "part /var/log --fstype ext3 --size=1024" >> /tmp/part-include
    %end

    However, when I try to increase the default size for /tmp and /var in the above code or use the following code:

    platform=x86, AMD64, or Intel EM64T

    %include /root/part-include

    version=DEVEL

    %pre --log=/root/pre.log

    !/bin/sh

    TOTAL=

    parted -s /dev/sda unit mb print free | grep Free | awk '{print $3}' | cut -d "M" -f1

    echo "# Clear the Master Boot Record" > /root/part-include
    echo "zerombr" >> /root/part-include
    echo "# Partition clearing information" >> /root/part-include
    echo "clearpart --all --initlabel" >> /root/part-include
    echo "# Disk partitioning information" >> /tmp/part-include
    echo "part / --fstype ext3 --grow --size=3968" >> /root/part-include
    echo "part /boot --fstype ext3 --size=128" >> /root/part-include
    echo "part /home --fstype ext3 --size=1024">> /root/part-include

    if [ "$TOTAL" -ge 256000 ]
    then
    #This set the minimum var partiton size to 150GB if the HD has more than 250GB
    echo "part /var --fstype ext3 --grow --size=153600" >> /root/part-include
    #This set the minimum tmp partiton size to 20GB if the HD has more than 250GB
    echo "part /tmp --fstype ext3 --grow --size=20480" >> /root/part-include
    else
    echo "part /var --fstype ext3 --size=10240" >> /root/part-include
    echo "part /tmp --fstype ext3 --size=1024" >> /root/part-include
    fi

    echo "part swap --fstype swap --size=2048" >> /root/part-include
    echo "part /var/log/audit --fstype ext3 --size=1024" >> /root/part-include
    echo "part /var/log --fstype ext3 --size=1024" >> /root/part-include
    %end

    The system isn't partitioned correctly. Instead it partitions the system with these sizes:
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda9 241G 1.1G 227G 1% /
    tmpfs 937M 0 937M 0% /dev/shm
    /dev/sda1 124M 36M 83M 31% /boot
    /dev/sda5 1008M 34M 924M 4% /home
    /dev/sda6 1008M 34M 924M 4% /tmp
    /dev/sda2 9.9G 187M 9.2G 2% /var
    /dev/sda7 1008M 35M 923M 4% /var/log
    /dev/sda8 1008M 34M 924M 4% /var/log/audit
    /dev/sr0 541M 541M 0 100% /media

    I haven't been able to see what I'm doing wrong or and I don't know if I'm just running into some limits.

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat