Internet SCSI (iSCSI) is a network protocol that allows you to use of the SCSI protocol over TCP/IP networks. It is good alternative to Fibre Channel-based SANs. You can easily manage, mount and format iSCSI Volumes under Linux. It allows access to storage over Ethernet.
The Open-iSCSI project is a high-performance, transport independent, multi-platform implementation of iSCSI. Open-iSCSI is partitioned into user and kernel parts. To use iSCSI on CentOS, you just need to install the iscsi-initiator-utils RPM package. This package provides the server daemon for the iSCSI protocol, as well as the utility programs used to manage it. The RPM package can be installed using yum command:
# yum install iscsi-initiator-utils
There are a few steps that are needed to set up a system to use iSCSI storage:
If you need a user name and password to access the storage, open /etc/iscsi/iscsid.conf to configure user name and password:
node.session.auth.username = MY_ISCSI_USER_NAME node.session.auth.password = MY_ISCSI_PASSWORD discovery.sendtargets.auth.username = MY_ISCSI_USER_NAME discovery.sendtargets.auth.password = MY_ISCSI_PASSWORD
You may also need to tweak and set other options. Refer to man page for more information.
Use the iscsiadm command, which is the command-line tool allowing discovery and login to iSCSI targets, as well as access and management of the open-iscsi database. If your storage server IP address is 192.168.1.5, enter:
# iscsiadm -m discovery -t sendtargets -p 192.168.1.5 # /etc/init.d/iscsi start
Now there should be a block device under /dev directory. To obtain new device name, type:
# fdisk -l
On my system, '/dev/sda
' was my new block device.
If a partition and file system don't already exist on the target, they must be created using fdisk and mkfs.ext3 commands:
# fdisk /dev/sda (type n to create a new partition, p for primary, and then 1 for the partition number, the defaults for the remaining questions are fine...) # mkfs.ext3 /dev/sda1
Mount new partition:
# mkdir /mnt/iscsi # mount /dev/sda1 /mnt/iscsi
Turn on the iSCSI service at boot time:
# chkconfig iscsi on
Open /etc/fstab file and append this directive:
/dev/sda1 /mnt/iscsi ext3 _netdev 0 0
Save and close the file.