http://tools.ietf.org/html/rfc4173
-If the root partition is not specified using \fBroot=\fR, one of the partitions found
-with label \fBROOT\fR or \fB/\fR will be used to boot from.
-
.TP
.B root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
e.g. root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
#!/bin/bash
-
+dracut_install umount
inst iscsistart
inst hostname
inst iscsi-iname
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
inst "$moddir/iscsiroot" "/sbin/iscsiroot"
+inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
instmods iscsi_tcp crc32c
iscsi_initiator=$(iscsi-iname)
fi
+if [ -z $iscsi_lun ]; then
+ iscsi_lun=0
+fi
+
echo "InitiatorName='$iscsi_initiator'" > /dev/.initiatorname.iscsi
-# FIXME $iscsi_lun?? $iscsi_protocol??
+# FIXME $iscsi_protocol??
-# if root does not specify a block device
-# we set a fallback to recognize any filesystems labeled
-# LABEL=/ or LABEL=ROOT
-if [ "${root#block:*}" = "$root" ]; then
- ( root="block:/dev/disk/by-label/\x2f" . /pre-udev/30-block-genrules.sh )
- ( root="block:/dev/disk/by-label/ROOT" . /pre-udev/30-block-genrules.sh )
-fi
+echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > /mount/iscsi.sh
iscsistart -i $iscsi_initiator -t $iscsi_target_name \
-g $iscsi_target_group -a $iscsi_target_ip \
--- /dev/null
+if [ -z $iscsi_lun ]; then
+ iscsi_lun=0
+fi
+NEWROOT=${NEWROOT:-"/sysroot"}
+
+for disk in /dev/disk/by-path/*-iscsi-*-$iscsi_lun; do
+ if mount -t ${fstype:-auto} -o "$rflags" $disk $NEWROOT; then
+ if [ ! -d /sysroot/proc ]; then
+ umount $disk
+ continue
+ fi
+ break
+ fi
+done
> "/etc/udev/rules.d/$x"
done
udevadm control --reload-rules
-# save a partition at the beginning for future flagging purposes
-sfdisk -C 640 -H 2 -S 32 -L /dev/sda <<EOF
-,,
-EOF
-#mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sda2 /dev/sda3 /dev/sda4
-# wait for the array to finish initailizing, otherwise this sometimes fails
-# randomly.
-#mdadm -W /dev/md0
-#echo -n test >keyfile
-#cryptsetup -q luksFormat /dev/sda1 /keyfile
-#echo "The passphrase is test"
-#cryptsetup luksOpen /dev/sda1 dracut_crypt_test </keyfile && \
-#lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test && \
-#lvm vgcreate dracut /dev/mapper/dracut_crypt_test && \
-#lvm pvcreate -ff -y /dev/sda1 && \
-#lvm vgcreate dracut /dev/sda1 && \
-#lvm lvcreate -l 100%FREE -n root dracut && \
-#lvm vgchange -ay && \
-mke2fs -L ROOT /dev/sda1 && \
+mke2fs -F /dev/sda && \
mkdir -p /sysroot && \
-mount /dev/sda1 /sysroot && \
+mount /dev/sda /sysroot && \
cp -a -t /sysroot /source/* && \
umount /sysroot && \
echo "dracut-root-block-created" >/dev/sdb