wiki'd

by JoKeru

Setup iSCSI Initiator

[cc lang='bash']
\$ yum install iscsi-initiator-utils -y
\$ chkconfig netfs on
\$ chkconfig iscsi on
\$ chkconfig iscsid on
\$ echo "InitiatorName=iqn.2013-05.ro.jokeru:"`hostname` > /etc/iscsi/initiatorname.iscsi
\$ service iscsid start
\$ service iscsi start

\$ iscsiadm -m discovery -t sendtargets -p 192.168.1.1
\$ iscsiadm -m node -T iqn.1992-08.com.netapp:storage1 -p 192.168.1.1
\$ iscsiadm -m node -T iqn.1992-08.com.netapp:storage1 -p 192.168.1.1 --login
\$ iscsiadm -m discovery -t sendtargets -p 192.168.1.2
\$ iscsiadm -m node -T iqn.1992-08.com.netapp:storage2 -p 192.168.1.2
\$ iscsiadm -m node -T iqn.1992-08.com.netapp:storage2 -p 192.168.1.2 --login

\$ i=1
\$ for dev in `ls -l /dev/disk/by-path/ | grep netapp | sort | awk '{print \$11}' | cut -d'/' -f3`
\$ do
\$ parted /dev/\$dev mklabel msdos
\$ parted /dev/\$dev mkpart primary 1 20480
\$ mkfs.ext4 "/dev/\$dev"1
\$ mkdir -p "/mnt/disk\$i"
\$ echo "/dev/disk/by-id/scsi-"`scsi_id -g /dev/\$dev`"-part1 /mnt/disk\$i ext4 _netdev 0 0" >> /etc/fstab
\$ ((i++))
\$ done

\$ reboot
[/cc]

Comments