Re: Dynamic partitioning in kickstart

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday 28 September 2002 09:39, Gopi wrote:
> Hi,
> 
>   I am new to this list. 
>   
>   I am using kickstart feature of redhat Linux for my project, i have
>   requirement which i don't find it in kickstart documentation. so i am
> posting
>   that to this list.
> 
>   My question is, I will be installing redhat Linux in various machines
> having
>   different hard disk capacity starting from 2GB to 40 GB and i would
> like to
>   have set of partitions in the hard disk (which is not redhat
> standard). my
>   pattern is something of 4 partitions namely,
>     primary partition
>         secondary partition
>         data partition
>         swap
>  is there any way i can automate this in kickstart that based on the
> size of
>  hard disk it should allocate a percentage of hard disk size to each
> partition.
>  for example 40% each for primary and secondary 15% for data 5% for swap
> like
>  that.
> 
>  Is this achievable in kickstart? if so how? i have read about %include
> file
>  option in kickstart but i don't know whether it can solve the problem.
> 
>  Kindly help me in this. If this is already discussed kindly let me in
> which
>  archive i can find more info about that.


In the ks file you can write shell scripts. I'm not sure whether you have the 
full power of bash available, you might have to assume you have and see what 
doesn't work.

You also have fdisk, and (maybe cut or awk).
fdisk can tell you what partitions already exist:
[root@numbat root]# fdisk -l /dev/hda

Disk /dev/hda: 255 heads, 63 sectors, 3737 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1         3     24066   83  Linux
/dev/hda2   *         4         5     16065    6  FAT16
/dev/hda3             6      3737  29977290   83  Linux
[root@numbat root]#

You can pipe stuff into fdisk:
fdisk /dev/hda <<==
p
==

So, you can find what the existing partitions are, or blindly delete them 
either by piping some commands into fdisk, or by using dd to write zeros over 
the existing partition table.

fdisk _can_ make a partition the size of the whole drive. Here is a sample 
fisk session:
[root@numbat root]# fdisk /dev/hda

The number of cylinders for this disk is set to 3737.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/hda: 255 heads, 63 sectors, 3737 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1         3     24066   83  Linux
/dev/hda2   *         4         5     16065    6  FAT16
/dev/hda3             6      3737  29977290   83  Linux

Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Partition number (1-4): 2

Command (m for help): d
Partition number (1-4): 3

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-3737, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-3737, default 3737):
Using default value 3737

Command (m for help):

If you run it like that, then
fdisk -l /dev/hda >diskinfo
then you can parse the file diskinfo (or the piped output of fdisk without 
using an intermediate file) to discover the size of the drive.

You can then use this information to caculate the partition sizes you want 
using either standard bash expressions or the eval command depending on what 
works, and create commands to pipe into fdisk to create the partitions you 
want.





-- 


Cheers
John.

Please, no off-list mail. You will fall foul of my spam treatment.
Join the "Linux Support by Small Businesses" list at 
http://mail.computerdatasafe.com.au/mailman/listinfo/lssb






[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux