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>
home
<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>
opt
<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>
root
<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>
swap
<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>
tmp
<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>
usr
<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>
var
<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>
131
1
primary
<size>500M</size>
</partition>
<partition>
<create config:type="boolean">false</create>
<format config:type="boolean">false</format>
rootvg
142
2
primary
<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