Conditional partitioning/formatting of device possible
Francisco Javier Lloreda Sanchez
flloreda at redhat.com
Mon Jan 21 08:10:57 UTC 2013
You can use a pre script to detect if is previously partitioned or not
and then use something similar to:
%pre
#!/bin/sh
Discover condition
if condition;
then
echo "part /boot --fstype ext3 --size=100 --ondisk=$DISCO" >>
/tmp/part-include
echo "part pv.100000 --size=1 --grow --ondisk=$DISCO" >>
/tmp/part-include
echo "volgroup Merca --pesize=32768 pv.100000" >> /tmp/part-include
echo "logvol swap --fstype swap --name=Swap --vgname=Merca
--size=2047" >> /tmp/part-include
echo "logvol / --fstype ext4 --name=root --vgname=Merca
--size=2048" >> /tmp/part-include
echo "logvol /home --fstype ext4 --size=1000 --name=home
--vgname=Merca" >> /tmp/part-include
else
echo "part /boot --fstype ext3 --size=100 --ondisk=$DISCO" >>
/tmp/part-include
echo "volgroup Merca --pesize=32768 --useexisting --noformat" >>
/tmp/part-include
echo "logvol swap --fstype swap --name=Swap --vgname=Merca
--size=2047 --useexisting --noformat" >> /tmp/part-include
echo "logvol / --fstype ext4 --name=root --vgname=Merca
--size=2048 --useexisting --noformat" >> /tmp/part-include
echo "logvol /home --fstype ext4 --size=1000 --name=home
--vgname=Merca --useexisting --noformat" >> /tmp/part-include
fi
Later in the partitioning section use %include /tmp/part-include
Hope this helps to you :)
--
Francisco Javier Lloreda
Red Hat Consultant
( RHCA , RHCDS , RHCVA ) #110-651-718
flloreda at redhat.com
Mobile: 0034 600 48 39 73
c/ Jose Bardasano Baos, No. 9
Edificio Gorbea 3
Madrid, 28016 SPAIN
El 21/01/13 08:29, Fred van Zwieten escribió:
> Hi there,
>
> Is there a possibility in the kickstart syntax to partition/format a
> device, but only if it's not already partitioned/formatted.
>
> Use case: I have a server with a data disk. First time deployment it
> should be partitioned and formatted. Second time, the data partition
> must be left as is and only mounted.
>
> I now about --noformat, but how to make that conditional?
>
> If not possible, I must use %post. Any examples on how to do this
> there using bash or python?
>
> Regards,
>
> Fred
>
>
> _______________________________________________
> Kickstart-list mailing list
> Kickstart-list at redhat.com
> https://www.redhat.com/mailman/listinfo/kickstart-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/kickstart-list/attachments/20130121/a1bd31c6/attachment.htm>
More information about the Kickstart-list
mailing list