Install and use iscsitarget and initiator in ubuntu12.04

Source: Internet
Author: User
In ubuntu12.04, iscsitarget and initiator are installed and used for the purpose of attaching a hard disk on a host as an iscsitarget to another host. 1. install software related to iscsitarget on the target side of iscsi www.2cto.com (1... install and use iscsi target and initiator in ubuntu 12.04. objective: to mount the hard disk on one host as one iscsi target to another host. 1. install iscsi target Software $ sudo apt-get install iscsitarget-source iscsitarget-dkms (2) modify the iscsi target configuration file $ sudo vi/etc/default/iscsitarget ISCSITARGET_ENABLE = true # change false to true (3) prepare storage for the target. the real hard disk can be used here, for example,/dev/sdx can also use a virtual machine disk, such as a dd file: dd if =/dev/zero of =/var/lun1.bin count = 0 obs = 1 seek = 50G. the following uses a real hard disk as an example to perform various operations. Configure the target under www.2cto.com Centos and configure the iscsi target under centos ### create a target, id = 1, iqn = iqn.2013-02. node2, iqn is the unique descriptor of the target in the Lan $ sudo tgtadm -- lld iscsi -- op new -- mode target -- tid 1-T iqn.2013-02. node2 ### run the following command to view the currently created target and lun www.2cto.com $ sudo tgtadm -- lld iscsi -- op show -- mode target ### add a lun to the specified target, use tid to specify the target. here, add/dev/sdl to the target of tid = 1. $ sudo tgtadm -- lld iscsi -- op new -- mode log Icalunit -- tid 1 -- lun 1-B/dev/sdl ### note:/dev/sdl is a whole disk. you can also add a partition to the target, for example,/dev/sdl1,/dev/sdb1 ### to enable a target to be accessed by initiator, you must first run the following command $ sudo tgtadm -- lld iscsi -- op bind -- mode target -- tid 1-I ALL ### delete the specified target, specify $ sudo tgtadm -- lld iscsi -- op show -- mode target -- op delete -- tid 1 configuration of iscsi target in ubuntu by using tid. configure iscsi target in ubuntu # vi/etc/iet /ietd. add the following information to the end of the conf file: Target iqn.2012-12.lo Cal. mynet: storage. lun1 // iqn.2012-12. local. mynet: storage. lun1 is iqn. for the format, see iqn Lun 1 Path =/dev/sdl1, Type = fileio in centos, ScsiId = lun1, ScsiSN = lun1. the content after Target in the first line can be modified as needed, however, it is best to keep the format in the example. The second line creates a LUN on the Target. after the serial number is 1 and the above configuration is executed, restart the iscsitarget service: centos service tgtd restartubuntu service iscsitarget restart (4) configure the iscsi target password-based Access Method (skip this step if you do not want to set a password, and this is the ubuntu configuration method) www.2cto.com assume that the username and password of the iscsi target to be configured are as follows: usernam E = dylan password = 123456 if the ISCSI Target Server requires a user name and password, you must go to/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. The two groups of usernames and passwords are the usernames and passwords set by Target Server. After modification, restart the open-iscsi service: # service open-iscsi restart 2. iscsi initiator end www.2cto.com (1) install open-scsi sudo apt-get install open-iscsi-utils (2) iscsi target sudo iscsiadm-m discovery-t sendtargets-p 192.168.35.17 is displayed as follows: 192.168.35.17: 3260,1 iqn.2013-02. node2 (3) use target sudo iscsiadm-m node -- targetname iqn.2013-02. node2-p 192.168.35.17 -- after login executes the preceding operations, you can add/dev/sdx (4) to the local host to delete target sudo iscsiadm-m node -- targetname iqn.2013-02. node2-p 192.168.35.17-u
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.