
On Tue, Sep 04, Hans-Joachim Ehlers wrote:
Given : SLES 11 SP1
Task: Create a LVM partition on /dev/sdb. In case the partition already exist just mount/import the LV.
Problem: I am able to create the LVM partition but i do not know how "import" a already existing partition nor how to prevent autoyast to overwrite the existing one.
Ny current thoughts are using a pre-script or rule to check if there is a already configured /dev/sdb with lvm . In case none exist the following config will be applied , in case a LVM partiton already exist a post script will import these partition from /dev/sdb
Still i would like to let autoyast do this but i do not know how ?
Any tips or already working config ?
It works with a pre-script and some sed trickery. I have a non-destructive default in partitioning section and change it when no lvm vg is detected in pre-script. I expect volume group rootvg on disk /dev/sdb I have the following partitioning section: <partitioning config:type="list"> <drive> <device>/dev/rootvg</device> <lvm2 config:type="boolean">true</lvm2> <partitions config:type="list"> <partition> <create config:type="boolean">false</create> <filesystem config:type="symbol">ext3</filesystem> <format config:type="boolean">true</format> <lv_name>home</lv_name> <mount>/home</mount> <mountby config:type="symbol">device</mountby> <size>1G</size> </partition> <partition> <create config:type="boolean">false</create> <filesystem config:type="symbol">ext3</filesystem> <format config:type="boolean">true</format> <lv_name>opt</lv_name> <mount>/opt</mount> <mountby config:type="symbol">device</mountby> <size>1G</size> </partition> <partition> <create config:type="boolean">false</create> <filesystem config:type="symbol">ext3</filesystem> <format config:type="boolean">true</format> <lv_name>root</lv_name> <mount>/</mount> <mountby config:type="symbol">device</mountby> <size>2G</size> </partition> <partition> <create config:type="boolean">false</create> <filesystem config:type="symbol">swap</filesystem> <format config:type="boolean">true</format> <lv_name>swap</lv_name> <mount>swap</mount> <mountby config:type="symbol">device</mountby> <size>500M</size> </partition> <partition> <create config:type="boolean">false</create> <filesystem config:type="symbol">ext3</filesystem> <format config:type="boolean">true</format> <lv_name>tmp</lv_name> <mount>/tmp</mount> <mountby config:type="symbol">device</mountby> <size>200M</size> </partition> <partition> <create config:type="boolean">false</create> <filesystem config:type="symbol">ext3</filesystem> <format config:type="boolean">true</format> <lv_name>usr</lv_name> <mount>/usr</mount> <mountby config:type="symbol">device</mountby> <size>2G</size> </partition> <partition> <create config:type="boolean">false</create> <filesystem config:type="symbol">ext3</filesystem> <format config:type="boolean">true</format> <lv_name>var</lv_name> <mount>/var</mount> <mountby config:type="symbol">device</mountby> <size>1G</size> </partition> </partitions> <pesize>32M</pesize> <type config:type="symbol">CT_LVM</type> <use>all</use> </drive> <drive> <device>/dev/sdb</device> <initialize config:type="boolean">false</initialize>" <partitions config:type="list"> <partition> <create config:type="boolean">false</create> <filesystem config:type="symbol">ext3</filesystem> <format config:type="boolean">true</format> <mount>/boot</mount> <mountby config:type="symbol">device</mountby> <partition_id config:type="integer">131</partition_id> <partition_nr config:type="integer">1</partition_nr> <partition_type>primary</partition_type> <size>500M</size> </partition> <partition> <create config:type="boolean">false</create> <format config:type="boolean">false</format> <lvm_group>rootvg</lvm_group> <partition_id config:type="integer">142</partition_id> <partition_nr config:type="integer">2</partition_nr> <partition_type>primary</partition_type> <size>max</size> </partition> </partitions> <use>all</use> </drive> </partitioning> and the following script section: <scripts> <pre-scripts config:type="list"> <script> <debug config:type="boolean">true</debug> <filename>pre_script</filename> <interpreter>shell</interpreter> <source><![CDATA[ if [ `pvs | grep sdb.*rootvg | wc -l` -eq 0 ] then cp -av /tmp/profile/autoinst.xml /tmp/profile/modified.xml sed -i "/device.*rootvg/,/<\/drive>/{/create/s/false/true/}" /tmp/profile/modified.xml sed -i "/device.*sdb/,/<\/drive>/{/initialize/s/false/true/}" /tmp/profile/modified.xml sed -i "/device.*sdb/,/<\/drive>/{/create/s/false/true/}" /tmp/profile/modified.xml fi ]]></source> </script> </pre-scripts> </scripts> Tschuess, Thomas Fehr -- Thomas Fehr, SuSE Linux Products GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) Tel: +49-911-74053-0, Fax: +49-911-74053-482, Email: fehr@suse.de GPG public key available. -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-autoinstall+owner@opensuse.org