CentOS iSCSI Configuration

Source: Internet
Author: User

The first is the settings for the server:
[[Email protected] Desktop]# yum install scsi-target-*-y installation Service The Yum method is too simple, I won't write it.
[[Email protected] Desktop]#/ETC/INIT.D/TGTD restart Restart Service
[[email protected] yum.repos.d]# tgtadm--lld iSCSI--op new--mode target--tid 1-t iqn.2010-06.com.yahoo:disk1 for ISC Si device has a name, name is anti-write domain name,
You can also do not write the domain name directly iqn.2010-06:disk1, this can also
[[email protected] yum.repos.d]# tgtadm--lld iSCSI--op New--mode logicalunit--tid 1--lun 1-b/dev/sdb1 Specify a local storage location
[[email protected] yum.repos.d]# tgtadm--lld iSCSI--op bind--mode target--tid 1-iall set all IP can be accessed, or it can be 192.168.1.0/24 Individual network segments, but cannot set multiple network segments
[[email protected] yum.repos.d]# Tgtadm--lld iSCSI--op Show--mode target view this
setting of the Machine
Target 1:iqn.2010-06.com.yahoo:disk1
System Information:
Driver:iscsi
State:ready
i_t Nexus Information:
LUN Information:
lun:0
Type:controller
SCSI Id:iet 00010000
SCSI SN:BEAF10
size:0 MB
Online:yes
Removable Media:no
Backing store Type:rdwr
Backing store Path:none
Lun:1
Type:disk
SCSI Id:iet 00010001
SCSI sn:beaf11
size:53686 MB
Online:yes
Removable Media:no
Backing store Type:rdwr
Backing store Path:/DEV/SDB1
Account information:
ACL Information:
All
[Email protected] yum.repos.d]#

The above settings expire after the system restarts, in order to ensure the normal use of the above command to write
to/etc/rc.d/rc.local let it boot load, as follows:
[[email protected] desktop] #cat/etc/ Rc.d/rc.local
#!/bin/sh
# #
This script would be a executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don ' t
# want to do the full Sys V style init stuff.
Touch/var/lock/subsys/local
mount/dev/cdrom/mnt/This is the boot auto-mount disc I set up
Tgtadm--lld iSCSI--op New--mode target--tid 1 -T iqn.2010-06.com.yahoo:disk1 
Tgtadm--lld iSCSI--op New--mode logicalunit--tid 1--lun 1-b/dev/sdb1
TG Tadm--lld iSCSI--op bind--mode target--tid 1-i all  more than three commands are written in and will automatically run when you start

Client mount settings:
[[email protected] yum.repos.d]# man iscsiadm view command help, parameters can be in the Help
Inside, so you don't have to memorize those boring command parameters.
[Email protected] yum.repos.d]# iscsiadm-m discovery-t sendtargets-p
192.168.1.123–discover View server sharing, name and IP remember pointing to the server
192.168.1.123:3260,1 Iqn.2010-06.com.yahoo:disk1
[[email protected] YUM.REPOS.D] #iscsiadm--mode node--targetname iqn.2010-
06.com.yahoo:disk1--portal 192.168.1.123:3260--login on client Login server
Share, name and IP address need to manually point to the server


[[Email protected] Desktop]# fdisk-l after landing to see your own drive letter
[[Email protected] Desktop]# FDISK/DEV/SDC create partition
[[Email protected] Desktop]# MKFS.EXT4/DEV/SDC1 formatted partition
[[Email protected] Desktop]# mount/dev/sdc1/iscsi/mount partition to native folder
[[Email protected] Desktop]# blkid view blkid, set boot mount
[[Email protected] Desktop]# vim/etc/fstab edit boot file
Uuid= "08b688b2-888f-4523-b936-dd4fcc443309"/iscsi ext4
Defaults,_netdev 0 0

The following is the client uninstallation process:
[[email protected]/]# umount/iscsi/optional unload mount
[Email protected] yum.repos.d]# iscsiadm-m node-t iqn.2010-
06.com.yahoo:disk1-p 192.168.1.123:3260–u then log off, log off and restart the service will automatically login
Logging out of Session [Sid:1, Target:iqn.2010-06.com.yahoo:disk1, portal:192.168.1.123,3260]
Logout of [Sid:1, Target:iqn.2010-06.com.yahoo:disk1, portal:192.168.1.123,3260] successful.
[Email protected]/]# iscsiadm-m node-o delete-t iqn.1013-06:disk1-p
192.168.1.123:3260-o Delete can delete it completely, so it's completely clean! If you do not delete will leave the process in the server to affect performance, so in the real environment when not used must remember to delete!

CentOS iSCSI Configuration

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.