let iSCSI try to mount the complete LUN specified
authorHarald Hoyer <harald@redhat.com>
Thu, 2 Jul 2009 09:40:05 +0000 (11:40 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 2 Jul 2009 09:47:27 +0000 (11:47 +0200)
dracut.8
modules.d/95iscsi/install
modules.d/95iscsi/iscsiroot
modules.d/95iscsi/mount-lun.sh [new file with mode: 0755]
test/TEST-30-ISCSI/create-root.sh

index dadc312..bc0aaef 100644 (file)
--- a/dracut.8
+++ b/dracut.8
@@ -117,9 +117,6 @@ associated fields.
 
 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
index 613c752..7f8c2e2 100755 (executable)
@@ -1,8 +1,9 @@
 #!/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
index c66f9d2..8ee7cbc 100755 (executable)
@@ -114,17 +114,15 @@ if [ -z $iscsi_initiator ]; then
     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 \
diff --git a/modules.d/95iscsi/mount-lun.sh b/modules.d/95iscsi/mount-lun.sh
new file mode 100755 (executable)
index 0000000..ff8d4d0
--- /dev/null
@@ -0,0 +1,14 @@
+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
index 32c1828..c23d71f 100755 (executable)
@@ -4,27 +4,9 @@ for x in 63-luks.rules 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
     > "/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