Tuesday, 28 July 2015

REDHAT 7: Configuring a server as ISCSI target

In this blog post, we will see how to configure an ISCSI target.

An ISCSI target is a server which provides some storage.

SCENARIO: In my server, I have a two drives "/dev/vda" and "/dev/vdb". In "/dev/vda" OS is installed and "/dev/vdb" is available free. This is shown in snapshot below:

STEP 1: Create a partition "/dev/vdb1", and a VG named "vgiscsi" and a LVM named as "lviscsi".

STEP 2:  Install "targetcli", using yum and enable it
yum install -y targetcli

systemctl enable target

STEP 3: Connect to "targetcli" and navigate to folder "backstore/block". Create a block device named "disk1" using LVM "/dev/vgiscsi/lviscsi". Process summarized in the snapshot below:

STEP 4: This step is needed only for demonstration for creating a fileio. If you need block device skip this step and proceed to STEP 5. 

Create a fileio named "disk2" in location "/root/disk2" with size 100MB.

Now, if you will see the configuration, you can see both "disk1" and "disk2".

STEP 5: Create a target with "iqn.2014-11.com.manoj:server. 

NOTE: iqn follows a naming convention https://en.wikipedia.org/wiki/ISCSI

STEP 6: Create an ACL with the previously created IQN, with an identifier named "client".

Now navigate to the newly created directory. 

1) acls ---> access control lists: restrict access to resources
2) luns ---> logical unit number: define exported resources
3) portals ---> define ways to reach the exported resources; consist in pairs of IP addresses and ports

STEP 7: Navigate to folder "luns" and create luns with "disk1" and "disk2".

STEP 8: Create portal with ip address and port.

STEP 9: Verify the final configuration as below and exit.

STEP 10:  Open port 3260 tcp in firewall.

STEP 11:  Activate target service at boot.

With this ISCSI target configuration is done.

I will write about ISCSI initiator in my next post.

Keep reading :)

No comments:

Post a Comment

Note: only a member of this blog may post a comment.