Derwynd's Weblog

Derwynd's Weblog

Partition Percentage wise in ks.cfg

Step 1:

Put the following lines in ks.cfg file in the %pre section
%pre

#!/bin/bash

# Check the disk size value and store in diskval
diskval=`fdisk -l | grep Disk | awk -F ” ” ‘{print $3}’| awk -F “.” ‘{print $1}’`

# for root as 20%
let “Partroot=($diskval*20/100)”
# for home as 20 %
let “Parthome=($diskval*20/100)”
# for usr as 50 %
let “Partusr=($diskval*50/100)”
# Swap space
let “Partswap=(`cat /proc/meminfo | grep ‘MemTotal:’ | awk -F ‘ ‘ ‘{print $2}’`*2/1024)”

echo “clearpart –all” >> /tmp/part-include
echo “part / –fstype ext3 –size $Partroot –ondisk sda” >> /tmp/part-include
echo “part swap –size=$Partswap –ondisk sda” >> /tmp/part-include
echo “part /home –fstype ext3 –size $Parthome –ondisk sda” >> /tmp/part-include
echo “part /usr –fstype ext3 –size $Partusr –grow –ondisk sda” >> /tmp/part-include

Step 2:

Just above the %packages section add the following line

clearpart –all
# Now in your ks file put the following line for partition
%include /tmp/part-include
%packages

Advertisements

November 10, 2008 - Posted by | Uncategorized

Sorry, the comment form is closed at this time.

%d bloggers like this: