let iSCSI try to mount the complete LUN specified

master
Harald Hoyer 2009-07-02 11:40:05 +02:00
parent 7e87a0bfa0
commit 4ce1991856
5 changed files with 24 additions and 32 deletions

View File

@ -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

View File

@ -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

View File

@ -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 \

14
modules.d/95iscsi/mount-lun.sh Executable file
View File

@ -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

View File

@ -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