Re: Conditional partitioning/formatting of device possible

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

 



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@xxxxxxxxxx
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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

[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