Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the installation and use of iscsi target and initiator in ubuntu 12.04

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about the installation and use of iscsi target and initiator in ubuntu 12.04. The article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.

Installation and use of iscsi target and initiator in ubuntu 12.04

The purpose of this experiment is to mount the hard disk on one host as an iscsi target to another host.

1. Target www.2cto.com of iscsi

(1) install iscsi target related software

$sudo apt-get install iscsitarget iscsitarget-source iscsitarget-dkms

(2) modify the configuration file of iscsi target

$sudo vi / etc/default/iscsitarget

ISCSITARGET_ENABLE=true # change false to true

(3) prepare storage for target

Here you can use a real hard drive, such as / dev/sdx, or you can use a virtual machine disk, such as a file from dd: dd if=/dev/zero of=/var/lun1.bin count=0 obs=1 seek=50G.

Let's take a real hard disk as an example to do various operations.

Www.2cto.com

Configuration operation of target under Centos

Iscsi target configuration under centos

# create a target,id=1,iqn=iqn.2013-02.node2. Iqn is the only descriptor of target in the LAN.

$sudo tgtadm-lld iscsi-op new-mode target-tid 1-T iqn.2013-02.node2

# you can view the currently created target and lun www.2cto.com using the following command

$sudo tgtadm-lld iscsi-op show-mode target

# add a lun to the specified target, and make the target through tid. Here, add / dev/sdl to the target of the tid=1.

Sudo tgtadm-- lld iscsi-- op new-- mode logicalunit-- tid 1-- lun 1-b / dev/sdl

# Note: / dev/sdl is a whole disk, and you can also add a partition to the target, such as / dev/sdl1,/dev/sdb1

# to enable a target to be accessed by initiator, you must first execute the following command

$sudo tgtadm-lld iscsi-op bind-mode target-tid 1-I ALL

# Delete the specified target, which is specified by tid

$sudo tgtadm-lld iscsi-op show-mode target-op delete-tid 1

Configuration operation of iscsi target under ubuntu

Iscsi target configuration under ubuntu

# vi / etc/iet/ietd.conf

Add the following information at the end of the file:

Target iqn.2012-12.local.mynet:storage.lun1 / / iqn.2012-12.local.mynet:storage.lun1 is iqn. For the format, see iqn in centos

Lun 1 Path=/dev/sdl1,Type=fileio,ScsiId=lun1,ScsiSN=lun1

The content after the first line Target can be modified at will, but it is best to keep the format in the example; the second line creates a LUN on the Target with the serial number 1

After the above configuration, you need to restart the iscsitarget service:

Centos

Service tgtd restart

Ubuntu

Service iscsitarget restart

(4) configure iscsi target with password access method (if you want to set no password, you can skip it, and this is the configuration method of ubuntu) www.2cto.com

Suppose the username and password of the iscsi target to be configured are as follows:

Username=dylan

Password=123456

If ISCSI Target Server requires a username and password, it needs to be configured in / etc/iscsi/iscsid.conf. The configuration options are as follows: node.session.auth.username = dylan

Node.session.auth.password = 123456

Discovery.sendtargets.auth.username = dylan

Discovery.sendtargets.auth.password = 123456

Where both groups of usernames and passwords are the usernames and passwords set by Target Server.

After the modification, you need to restart the open-iscsi service:

# service open-iscsi restart

2. Www.2cto.com on iscsi initiator

(1) install open-scsi

Sudo apt-get install open-iscsi open-iscsi-utils

(2) find iscsi target

Sudo iscsiadm-m discovery-t sendtargets-p 192.168.35.17

The information is displayed as follows:

192.168.35.17purl 3260 iqn.2013-02.node2

(3) use target

Sudo iscsiadm-m node-- targetname iqn.2013-02.node2-p 192.168.35.17-- login

After doing the above, you can have an extra / dev/sdx on the local host

(4) Delete target

Sudo iscsiadm-m node-- targetname iqn.2013-02.node2-p 192.168.35.17-u

This is how the installation and use of iscsi target and initiator in ubuntu 12.04 are shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report