2009/10/02

iSCSI initiator on CentOS 5

yum install iscsi-initiator-utils

vi /etc/iscsi/initiatorname.iscsi

vi /etc/iscsi/iscsid.conf
# In particular, if using authentication:
node.session.auth.username = ISCSI_USER_NAME
node.session.auth.password = Password
discovery.sendtargets.auth.username = ISCSI_USER_NAME
discovery.sendtargets.auth.password = Password

chkconfig iscsi on
service iscsi start

iscsiadm --mode discovery --type sendtargets --portal
or
iscsiadm --mode node --targetname --portal :3260 --login

service iscsi restart

chkconfig iscsid on
service iscsid start

Now the device nodes should be present
fdisk, do whatever, and in /etc/fstab, your entry should look something like this:

/dev/sdb1 /mnt/foo ext3 _netdev 0 0

Note that if you want to use lvm, you should ensure that the iscsi devices are on separate volume groups from your root and system filesystems; else, the system may be non-bootable if the iSCSI targets cannot be reached.