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

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

 

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>