Quick Set up an icsi-target for VMware ESX iSCSI datastore
Information Technology, VMware, Virtualization 1 Comment »Introduction
In this post, a quick set up an iSCSI target will be presented. With this iSCSI target we can set up a iSCSI datastore on our VMware ESX 3.5/3i server for testing.
Set up an iSCSI target
On my RHEL 5 server running on my network, I already set up many virtual machines (VM) using hypervisor Xen that comes with RHEL 5. One of my VMs is RHEL 4ES. This VM will be modified to add iscsi-target for our goal.
First of all, we need to create an extra disk for RHEL 4ES that will be used as iscsi storage. Log in RHEL 5Server and add one more image, named 4es_iscsi.img for RHEL 4ES VM. This image has size of 40GB, its is enough for our test.
[root@slx002 /]# dd if=/dev/zero of=/vm/4es_iscsi.img bs=1024k count=40000
In the /etc/xen/rhel4es configuration file of RHEL 4ES VM, add one disk:
before:
....
disk = [ 'file:/vm/rhel4es.img,hda,w', 'file:/vm/rhel4es2.img,hdb,w']
after:
....
disk = [ 'file:/vm/rhel4es.img,hda,w', 'file:/vm/rhel4es2.img,hdb,w', 'file:/vm/4es_iscsi.img,hdc,w' ]
This disk will be appeared as /dev/hdc in our RHEL 4ES VM.
After modifying the Xen configuration file of RHEL 4ES, we need restart this VM.
Set up iscsi-target on RHEL 4ES Xen virtual machine
The iscsi-target is available on my Web-site at extras of my RHEL 4ES. The iscsi-target RPMS packages for kernel 2.6.9-67.0.1 are also available on extras of my RHEL 4ES. If your RHEL 4ES doesn’t run that kernel you can recompile the iscsi-target packages from the source at the above link.
Install the two packages by running as root:
# rpm -UVh iscsitarget-0.4.12-6.i386.rpm iscsitarget-kernel-0.4.12-6_2.6.9_67.0.1.EL.i386.rpm
Now we modify iscsi-target configuration file: /etc/ietd.conf
# Example iscsi target configuration # # Everything until the first target definition belongs # to the global configuration. # Right now this is only the user configuration used # during discovery sessions. "IncomingUser" specifies credentials the # initiator has to provide - several of these are supported. If mutual # CHAP shall be employed, "OutgoingUser" specifies the user/pass # combination the target will provide - only one is supported.
# Targets definitions start with "Target" and the target name. # The target name must be a globally unique name, the iSCSI # standard defines the "iSCSI Qualified Name" as follows: # # iqn.yyyy-mm.<reversed domain name>[:identifier] # # "yyyy-mm" is the date at which the domain is valid and the identifier # is freely selectable. For further details please check the iSCSI spec. #Target iqn.2007-06.net.vcomtech.slx002:storage Target iqn.2006-03.net.vcomtech:storage.hdc1.raw # Users, who can access this target. The same rules as for discovery # users apply here. # (no users means anyone can access the target) #IncomingUser joe secret #OutgoingUser jim 12charpasswd IncomingUser vinhle passwordgohere OutgoingUser vinhle passwordgohere # Logical Unit definition # You must define one logical unit at least. # Block devices, regular files, LVM, and RAID can be offered # to the initiators as a block device. Lun 0 Path=/dev/hdc,Type=fileio
# Alias name for this target Alias iSCSILUN
Attention to CHAP strings that I set up in this configuration file. We will use it/them for CHAP set up on VMware ESX server.
IncomingUser vinhle passwordgohere OutgoingUser vinhle passwordgohere
Of course you can not use it, but in this post I choose it as an illustrationfor using CHAP in iSCSI storage.
Turn on iscsi-target service on this RHEL 4ES box:
#chkconfig --add iscsi-target
#chkconfig --level 35 iscsi-target on
Restart iscsi-target service on this RHEL 4ES box
[root@vls031 ~]# service iscsi-target start
Starting iSCSI target service: [ OK ]
[root@vls031 ~]#
Verify the /var/log/message, if you see these new entries:
Feb 27 06:09:34 vls031 kernel: iSCSI Enterprise Target Software - version 0.4.12
Feb 27 06:09:34 vls031 kernel: iotype_init(90) register fileio
Feb 27 06:09:34 vls031 kernel: iotype_init(90) register nullio
Feb 27 06:09:34 vls031 iscsi-target: ietd startup succeeded
Feb 27 06:09:58 vls031 kernel: sess_param(173) 1 1 1 8192 8192 262144 65536 2 20 1 1 1 0 1 1
That means everything is OK for iscsi-target. Now we switch to our VMware ESX 3.5/3i server.
Set up iSCSI datastore on VMWare ESX 3.5/3i
We prepared an iSCSI target with size of 40GiB on one RHEL 4ES Xen VM, its IP : 192.168.10.31. Now it’s time to set up an iSCSI storage on our VMware ESX server.
Below are the screenshots on my VMware ESX 3i server.
Recent Comments