As I wrote before about enabling multipathing for the AutoYaST installation it’s about time I write this one here.

Sadly AutoYaST needs a little push in the right direction (as to where to actually put the root device), so here’s part of my AutoYaST profile for such a Cisco blade:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">

	<bootloader>
		<device_map config:type="list">
			<device_map_entry>
				<firmware>hd0</firmware>
				<linux>/dev/sda</linux>
			</device_map_entry>
		</device_map>
	</bootloader>

	<partitioning config:type="list">
		<drive>
			<device>/dev/sda</device>
		</drive>
	</partitioning>

	<scripts>
		<pre-scripts config:type="list">

			<script>
				<debug config:type="boolean">false</debug>
				<feedback config:type="boolean">false</feedback>
				<filename>config-ucs.sh</filename>
				<interpreter>shell</interpreter>
				<source><![CDATA[
cat /tmp/profile/autoinst.xml | sed "s,/dev/sda,/dev/mapper/`/sbin/multipath -ll | grep dm-0 | cut -d  -f1`," > /tmp/profile/modified.xml
]]>
				</source>
			</script>

		</pre-scripts>

		<chroot-scripts config:type="list">

			<script>
				<chrooted config:type="boolean">true</chrooted>
				<debug config:type="boolean">true</debug>
				<feedback config:type="boolean">true</feedback>
				<filename>config-ucs-chroot.sh</filename>
				<interpreter>shell</interpreter>
				<location>http://install.home.barfoo.org/autoyast/scripts/config-ucs-chroot.sh</location>
			</script>

		</chroot-scripts>
	</scripts>

	<software>
		<packages config:type="list">
			<package>multipath-tools</package>
		</packages>
	</software>

</profile>

Now, the profile addition takes care of the placement of the root-device now (simply parses multipath -ll) and adjusts the pulled profile accordingly ( /tmp/profile/modified.xml), which AutoYaST then re-reads.

Now, after installing the system, it’s gonna come up broken and shitty. That’s what the chroot-script above is for. This script looks like this (the original idea was here, look through the attachments):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

echo "defaults {
	user_friendly_names yes
	bindings_file /etc/multipath_bindings
}" > /etc/multipath.conf

sleep 1

# Fix wrong root-path in /etc/fstab
sed -i 's/mapper/.*_part/disk/by-id/scsi-mpatha-part/' /etc/fstab

# Fix grub root-path and wrong root-partition
sed -i -e 's/mapper/.*_part/disk/by-id/scsi-mpatha-part/'
	-e 's,scsi-mpatha-part2,scsi-mpatha-part3,' /boot/grub/menu.lst

# Fix the device.map
echo -e "(hd0)t$( ls /dev/disk/by-id/scsi-* | grep -v part )" > /boot/grub/device.map

sleep 1
mkinitrd -f multipath

What the script does, is 1) fix the occurances of /dev/mapper/, since this isn’t the proper way 2) create a multipathing initrd. Without the creation of the multipath-aware initrd the system will also not boot!