Skip to contentSkip to conversation

iscsi boot xen0 initrd

DISCUSSION James Harper 1 participant 1 message Oct 9, 2004

lore
Share & tools
lore
#0 lore raw

In case it helps anyone, here's a script I use to boot xen0 over iscsi with an initrd using linux-iscsi and iscsi-init (both on sourceforge). Some (or most) of it might be debian (sarge) specific though. The script goes in /etc/mkinitrd/scripts and puts the bits and pieces in place. It has to prepend stuff to /script in the resultant initrd so it does a few funny things. Add your Ethernet module to /etc/mkinitrd/modules too. It also takes care of the bridging by setting up the bridge before loading iscsi-init which brings up the interface via dhcp or manually.

#!/bin/sh

MOD=find /lib/modules/$VERSION -name 'iscsi_sfnet.*o' mkdir -p $INITRDDIR/dirname $MOD
cp $MOD $INITRDDIR/$MOD

MOD=find /lib/modules/$VERSION -name 'crc32c.*o' mkdir -p $INITRDDIR/dirname $MOD
cp $MOD $INITRDDIR/$MOD

MOD=find /lib/modules/$VERSION -name 'libcrc32c.*o' mkdir -p $INITRDDIR/dirname $MOD
cp $MOD $INITRDDIR/$MOD

MOD=find /lib/modules/$VERSION -name 'iscsi_init.*o' mkdir -p $INITRDDIR/dirname $MOD
cp $MOD $INITRDDIR/$MOD

depmod -a -b $INITRDDIR $VERSION

mv $INITRDDIR/script $INITRDDIR/script.post-iscsi
chmod 777 $INITRDDIR/script.post-iscsi

if [ echo $VERSION | grep '\-xen0$' ]
then
cp which brctl $INITRDDIR/sbin
cp /usr/lib/libsysfs.so.1 $INITRDDIR/lib
cat <<EOF >>$INITRDDIR/script
/sbin/ifconfig eth0 up
/sbin/brctl addbr br0
/sbin/brctl setfd br0 0
/sbin/brctl addif br0 eth0
EOF
fi

cat <<EOF >>$INITRDDIR/script
mount -nt tmpfs tmpfs /dev
modprobe -k iscsi_sfnet
modprobe -k iscsi_init
umount /dev
EOF
cat $INITRDDIR/script.post-iscsi >>$INITRDDIR/script rm $INITRDDIR/script.post-iscsi
chmod 777 $INITRDDIR/script

-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl