on Tuesday 08 June 2010 Peter Pointner wrote:
I am trying (on openSuse 11.2) to create a rules file and classes to create a software raid if the pc has 2 hard disks. My first try is to use disksize rules for /dev/sda and /dev/sdb. This failed, because I booted from USB stick, and the first SATA disk became /dev/sda, the USB stick became /dev/sdb, and the second SATA disk became /dev/sdc.
Probably I will find a way to find out if there are 2 disks,
in that case you indeed need a custom rule. I used something like that for a
project I did in the past:
<rule>
<custom1>
<script>
<![CDATA[
NUM=`hwinfo --disk|grep -c "Hardware Class:"`
# yeah, I know, I don't catch errors here
if [ "x$NUM" == "x1" ]; then
echo -n "one"
elif [ "x$NUM" == "x2" ]; then
echo -n "two"
else
echo -n "three"
fi;
]]>
</script>
<match>*</match>
but what to use for the "device" attribute of the "partitioning" section? Is there a generic way to specify the first, second, ... harddisk without getting disturbed by USB sticks?
a USB stick can disturb autoyast's device-autodetection (I think there is room
for improvement . it's on my TODO now).
You can try to specify no device at all and autoyast will guess. But in your
case there is a good chance that will fail and autoyast will use the USB
stick.
You can use <device>/dev/disk/by-id/....</device> or /dev/disk/by-path/....
because those should not change.
If that is not an option for you either, you can only use a pre-script with
some device detection written by you.
put <device>___dev1___</device> or so in your partitioning section and "sed"
those values out with a pre-script in /tmp/profile/autoinst.xml
Write the modified script to /tmp/profile/modified.xml
Autoyast will read it again before it's parsing the partitioning section.
If you don't have the USB stick always plugged in, the bootloader can get
confused too if you don't use by-id or by-path devices for the grub config
because the root/boot-device changes.
Sorry, but that's the only way at the moment.
I'll do something like