ISCSI TARGET AND INITIATOR

From this post we can talk about how to create an ISCSI target on one VM and how to connect from another ISCSI initiator on another VM.

  • First go to the first VM and install iscsi target.

yum install scsi-target-utills -y

  • After the installation we can run the service and check the status.

/etc/init.d/tgtd start

/etc/init.d/tgtd status

50

  • From the following command we can check targets and LUNs.

tgtadm –mode target –op show

  • Next add following details to iptables. Save it and restart.

53

54

55

  • Now let’s Partition the drive using fdisk command as shown below.

56

  • Then give the following inputs,
Command (m for help): n
Command action : p
   e   extended
   p   primary partition (1-4)
Partition number (1-4): 1
First sector (2048-37748735, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-37748735, default 
37748735): 
Using default value 37748735
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p

Disk /dev/sda: 19.3 GB, 19327352832 bytes
255 heads, 63 sectors/track, 2349 cylinders, total 37748736 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9fae99c8

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    37748735    18873344   8e  Linux LVM
  • Now let’s create a physical vloume.

pvcreate /dev/sda1

  • Next create a volume group.

vgcreate VolGroup1 /dev/sda1

lvcreate -L 4G -n work VolGroup1

  • Now using following command we can check them.

60

61

63

  • Now do the following changes to the /etc/tgt/targets.conf and reload.

70

71

  • Now check the availble LUNs.

72

73

Now our ISCSI target is ready. Now let’s go to the next VM and create a initiator there.

  • Install initiator at the VM.

80.png

  • From the following command we can find the target. IP address should be the IP of the ISCSI target VM.

81.png

  • To log-in use the below command to attach the LUN to our local System, this will authenticate with target server and allow us to log-in into LUN.

90.png

Hope now you have a clear idea about ISCSI target and initiator. See you soon with anther post. Thank You!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s