Wednesday, November 2, 2011

How to Create and use the iSCSI target service on the NAS

Contents
  • Connect to the iSCSI targets by Microsoft iSCSI initiator on Windows
  • Connect to the iSCSI targets by Xtend SAN iSCSI initiator on Mac OS
  • Connect to the iSCSI targets by Open-iSCSI Initiator on Ubuntu Linux
What is iSCSI and how can one benefits from it?
Microsoft Active DirectoryiSCSI, (Internet Small Computer System Interface), an Internet Protocol (IP)-based storage networking standard for linking data storage facilities. By carrying SCSI commands over IP networks, iSCSI is used to facilitate data transfers over intranets and to manage storage over long distances. iSCSI can be used to transmit data over local area networks (LANs), wide area networks (WANs), or the Internet and can enable location-independent data storage and retrieval. (quoted from Wikipedia)
This article demonstrates how you can use the iSCSI target service on NAS for storage expansion on different operating systems. See below for the usage scenario.
iSCSI target usage scenario
Things to know before we start
In between the relationship of your computer and the storage device, your computer is called an 'initiator' because it initiates the connection to the device, which is called a 'target'.
Note: It is NOT suggested to connect to the same iSCSI target with two different clients (iSCSI Initiators) at the same time, because this may lead to data crash or disk damage.
To begin, simply follow through the step-by-step guide below.

Connect to the iSCSI targets by Microsoft iSCSI initiator on Windows
This article shows you how to use the iSCSI initiator on Windows to add the iSCSI target as an extra partition. Before you start to use the iSCSI target service, make sure you have created an iSCSI target on the NAS in ‘Device Configuration' > ‘iSCSI Target' and installed the correct iSCSI initiator for your OS.
iSCSI Initiator on Windows
The Microsoft iSCSI Software Initiator v2.07 is an official application for Windows OS 2003, XP, and 2000 to allow users to implement an external iSCSI storage array over the network. If you are using Windows Vista or Windows Server 2008, the Microsoft iSCSI Software Initiator is included. For more information and the download location, please visit:
http://www.microsoft.com/downloads/details.aspx?familyid=12cb3c1a-15d6-4585-b385-befd1319f825&displaylang=en
Start iSCSI initiator from 'Control Panel' > 'Administrative Tools'. Under the 'Discovery' tab click on 'Add Portal'. Enter the NAS IP and the port number for the iSCSI service.
Enter the IP address of the NAS to start the discovery
The available iSCSI targets and their status will then be shown under the 'Targets' tab. Select the target you wish to connect then click on 'Log on'.
Enter the IP address of the NAS to start the discovery
You may click on 'Advanced' to specify the logon information if you have configured the authentication otherwise simply click on 'OK' to continue.
Confirm to log on to the chosen target
Upon successful logon, the status of the target now shows "Connected".
The status of the target now shows 'Connected'
After the target has been connected Windows will detect its presense and treat it as if there was a new hard drive has been added which needs to be initialized and formated before we can use it. Right-click on 'My Computer' > 'Manage' to open the 'Computer Management' window then go to "Disk Management" and a window should pop-up automatically asking whether you wanna initialize the newly found hard drive. Click on OK then format this drive as normally you would when adding a new disk.
The status of the target now shows 'Connected'
That's it! After disk initialization & formatting, the new drive is attached to your PC. You can now use this iSCSI target as a regular disk partition.
Connect to the iSCSI targets by Xtend SAN iSCSI initiator on Mac OS
Since GlobalSAN iSCSI initiator was reported to have stability concern when dealing with heavy load, we have selected to use Xtend SAN iSCSI Initiator as an example in this application notes.

About Xtend SAN iSCSI Initiator
ATTO's Xtend SAN iSCSI Initiator for Mac OS X allows Mac users to utilize and benefit from iSCSI. It is compatible with Mac® OS X 10.4.x to 10.6.x. For more information, please visit: http://www.attotech.com/products/product.php?sku=INIT-MAC0-001
After installing Xtend SAN iSCSI Initiator, you can find it in "Applications".
Click the "Discover Targets" tab, you can either choose "Discover by DNS/IP" or "Discover by iSNS" according to the network topology. In this example, we will use the IP address to discover the iSCSI targets.
Follow the screen instructions and enter the server address, iSCSI target port number (default: 3260), and CHAP information (if applicable). Click "Finish" to retrieve the target list after all the data have been entered correctly.
All the available iSCSI targets on the NAS server will be shown. Select the target you would like to connect and click "Add".
You can configure the connection properties of the selected iSCSI target in the "Setup" tab.
Click the "Status" tab, select the target to connect. Then click "Login" to proceed.
Connect to the iSCSI targets by Open-iSCSI Initiator on Ubuntu Linux
This article shows you how to use Linux Open-iSCSI Initiator on Ubuntu to add the iSCSI target (QNAP NAS) as an extra partition. Before you start to use the iSCSI target service, make sure you have created an iSCSI target on the NAS in ‘Device Configuration’ > ‘iSCSI Target’ and installed the correct iSCSI initiator for your OS.
About Linux Open-iSCSI Initiator
The Linux Open-iSCSI Initiator is a built-in package in Ubuntu 8.04 LTS (or later). You can connect to an iSCSI volume at a shell prompt with just a few commands. More information about Ubuntu is available at http://www.ubuntu.com/ and for information and download location of Open-iSCSI, please visit: http://www.open-iscsi.org/
Before you start
Install the open-iscsi package. The package is also known as the Linux Open-iSCSI Initiator.
# sudo apt-get install open-iscsi
Now follow the steps below to connect to an iSCSI target NAS with Linux Open-iSCSI Initiator.
You may need to modify the iscsid.conf for CHAP logon information, such as node.session.auth.username & node.session.auth.password.
# vi /etc/iscsi/iscsid.conf
Save and close the file, then restart the open-iscsi service.
# /etc/init.d/open-iscsi restart
Discover the iSCSI targets on a specific host, e.g. 10.8.12.31 with default port 3260.
# iscsiadm -m discovery -t sendtargets -p 10.8.12.31:3260
Check the available iSCSI node(s) to connect.
# iscsiadm -m node
** You can delete the node(s) you don’t want to connect to when the service is on with the following command:
# iscsiadm -m node --op delete --targetname THE_TARGET_IQN
Restart open-iscsi to login all the available nodes.
# /etc/init.d/open-iscsi restart
You should be able to see the login message as below: Login session [iface: default, target: iqn.2004-04.com:NAS:iSCSI.For Ubuntu.B9281B, portal: 10.8.12.31,3260] [ OK ]
Check the device status with dmesg.
# dmesg | tail
Enter the following command to create a partition, /dev/sdb is the device name.
# fdisk /dev/sdb
Format the partition.
# mkfs.ext3 /dev/sdb1
Mount the file system.
# mkdir /mnt/iscsi


# mount /dev/sdb1 /mnt/iscsi/
That’s it! You can test the I/O speed using the following command.
# hdparm -tT /dev/sdb1
Below are some “iscsiadm” related commands.
Discover the Targets on the host:
# iscsiadm -m discovery --type sendtargets --portal HOST_IP
Login to a Target:
# iscsiadm –m node --targetname THE_TARGET_IQN --login
Logout from a Target:
# iscsiadm –m node --targetname THE_TARGET_IQN --logout
Delete a Target:
# iscsiadm –m node --op delete --targetname THE_TARGET_IQN


No comments:

Post a Comment