ISCSI technology is a SCSI instruction set that is developed by IBM and used by hardware devices to run on the upper layer of the IP protocol, this command set allows you to run the SCSI protocol on an IP network so that it can select routes on high-speed Gigabit Ethernet. ISCSI is a new storage technology that combines existing SCSI interfaces with Ethernet technologies to allow servers to exchange data with storage devices using IP networks. Configure the server as follows: [roo
ISCSI technology is a SCSI instruction set that is developed by IBM and used by hardware devices to run on the upper layer of the IP protocol, this command set allows you to run the SCSI protocol on an IP network so that it can select routes on high-speed Gigabit Ethernet. ISCSI is a new storage technology that combines existing SCSI interfaces with Ethernet technologies to allow servers to exchange data with storage devices using IP networks.
Configure the server as follows:
[Root @ localhost desktop] # yum install scsi-target-*-y the method for installing the service to configure yum is too simple and I will not write it
[Root @ localhost desktop] #/etc/init. d/tgtd restart the service
[Root @ www yum. repos. d] # tgtadm -- lld iscsi -- op new -- mode target -- tid 1-T iqn.2010-06.com. yahoo: disk1 is the name of the iscsi Device, which is the domain name of the anti-Write Device,
Alternatively, do not directly write the domain name as iqn.2010-06: disk1.
[Root @ www yum. repos. d] # tgtadm -- lld iscsi -- op new -- mode logicalunit -- tid 1 -- lun 1-B/dev/sdb1 specify a local storage location
[Root @ www yum. repos. d] # tgtadm -- lld iscsi -- op bind -- mode target -- tid 1-IALL set that all IP addresses can access, or they can be separately CIDR blocks such as 192.168.1.0/24, however, you cannot set multiple CIDR blocks.
[Root @ www yum. repos. d] # tgtadm -- lld iscsi -- op show -- mode target
Machine Settings
Goal 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
[Root @ www yum. repos. d] #
The above settings expire after the system is restarted. To ensure normal use of the system, you need to write the above commands
To/etc/rc. d/rc. local, load it at startup, as shown below:
[Root @ www desktop] # cat/etc/rc. d/rc. local
#! /Bin/sh
##
This script will be 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 auto-mounted CD
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
Tgtadm -- lld iscsi -- op bind -- mode target -- tid 1-I ALL the above three commands will be automatically run upon startup
The following are the client mounting settings:
[Root @ localhost yum. repos. d] # man iscsiadm
Find it, so you don't have to memorize the boring command parameters.
[Root @ localhost yum. repos. d] # iscsiadm-m discovery-t sendtargets-p
192.168.1.123-discover
192.168.1.123: 3260,1 iqn.2010-06.com. yahoo: disk1
[Root @ localhost yum. repos. d] # iscsiadm -- mode node -- targetname iqn.2010-
06.com. yahoo: disk1 -- portal 192.168.1.123: 3260-login log on to the server on the client
You must manually direct the name and IP address to the server.
[Root @ www desktop] # view your drive letter after logging on to fdisk-l
[Root @ www desktop] # create a partition using fdisk/dev/sdc
[Root @ www desktop] # mkfs. ext4/dev/sdc1 format Partition
[Root @ www desktop] # mount/dev/sdc1/iscsi/mount the partition to the local folder
[Root @ localhost desktop] # view blkid by blkid and set the Mounting Mode
[Root @ www desktop] # vim/etc/fstab edit the boot file
UUID = "08b688b2-888f-4523-b936-dd4fcc443309"/iscsi ext4
Defaults, _ netdev 0 0
The following describes how to uninstall a client:
[Root @ www/] # umount/iscsi/select detach mounting
[Root @ localhost yum. repos. d] # iscsiadm-m node-T iqn.2010-
06.com. yahoo: disk1-p 192.168.1.123: 3260-u
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.
[Root @ www/] # iscsiadm-m node-o delete-T iqn.1013-06: disk1-p
192.168.1.123: 3260-o delete can be completely deleted, so that it is completely deleted! If it is not deleted, a process will be left on the server, affecting performance. Therefore, you must remember to delete it when it is not used in a real environment!