iscsi san on centos

Question:

How do I setup Centos to be an iscsi san server

Answer:

Install scsi-target-utils

How to install scsi-target-utils

# yum install scsi-target-utils

Configure service to start on boot

# service tgtd start
# chkconfig tgtd on

How to create iscsi drives called targets

iSCSI is comprised of two components. A target and an initiator. The target is the iscsi or san server. The initiator is the client device connecting to the iscsi server.

Targets LUN can be either LVM logical volume, a disk partition, a whole disk, or a file.

scsi-target-utils is controlled on the cli by commands. New scsi-target-utils has a configuration file

/etc/tgt/targets.conf

Add the following to the targets.conf file to create the target “iqn.2010-10.example:iscsi.shares” and with two LUNs /dev/sdb1 /dev/sdb2

<target iqn.2010-10.example:iscsi.shares>
backing-store /dev/sdb1
backing-store /dev/sdb2
</target>

Initiate the changes (have tgt re-read config file)

#tgt-admin --execute

List Active Targets

# tgtadm –lld iscsi –mode target –op show

Open Firewall to allow iSCSI connections

Open port 3260

# system-config-securitylevel-tui

add 3260:tcp

Check that the port is open

# iptables -L
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:iscsi-target
Fabio Milano has written 80 articles for us. Fabio Milano is a certified RHCE, MCP, and CFOI. He runs an IT consulting and services company called RDS Support inc. Website:http://www.rdssupport.com
The information provided is for educational purposes only. All content including links and comments is provided "as is" with no warranty, expressed or implied. Use is at your own risk and you are solely responsible for what you do with it.

2 Comments so far

  1. ahmed on September 18th, 2012

    many thanks

  2. questioner on November 1st, 2012

    How do I set up a virtual cd/dvd as additional lun in centos/rhel 6.x?

Leave a reply