RSS

Connect to the iSCSI targets by Open-iSCSI Initiator on Ubuntu Linux

14 Jan

This section 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 with a LUN on the NAS 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 (QNAP 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 (the QNAP NAS in this example), for example, 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 do not 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.ForUbuntu.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/

 

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 a target:

# iscsiadm –m node –targetname THE_TARGET_IQN –login

 

Logout a target:

# iscsiadm –m node –targetname THE_TARGET_IQN –logout

 

Delete a Target:

# iscsiadm –m node –op delete –targetname THE_TARGET_IQN

 

Copy from: http://docs.qnap.com/nas/en/index.html?connect_iscsi_targets_linux.htm

Advertisements
 
Leave a comment

Posted by on January 14, 2014 in Linux, Ubuntu

 

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

 
%d bloggers like this: