How to build iscsi-target Server by rhel6.3
This article mainly introduces rhel6.3 how to build iscsi-target server, the article is very detailed, has a certain reference value, interested friends must read it!
Let's take a look at how to build an iscsi-target server on RHEL6.3 and how to mount a client.
I. server-side operation
Server version:
[root@racscsi home] # uname-r
2.6.32-279.el6.x86_64
[root@racscsi home] # cat / etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Install the iscsi server package.
Install it in the RPM way.
[root@racscsi home] # rpm-ivh scsi-target-utils-1.0.24-2.el6.x86_64.rpm
Warning: scsi-target-utils-1.0.24-2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... # [100%]
Package scsi-target-utils-1.0.24-2.el6.x86_64 is already installed
Install with the yum command (you need to configure the YUM source yourself)
[root@racscsi home] # yum-y install scsi-target-utils
Start the service and add to boot self-startup.
[root@racscsi home] # / etc/init.d/tgtd start
Starting SCSI target daemon: [OK]
[root@racscsi home] # chkconfig tgtd on
Use the fdisk command to create several partitions, or map shared partitions through external storage.
The server has been partitioned into / dev/sdb, / dev/sdc, / dev/sdd, / dev/sde, / dev/sdf, / dev/sdg, / dev/sdh, / dev/sdi for client mount
Next we need to edit the configuration file / etc/tgt/targets.conf and set iSCSI Qualified Name (IQN).
[root@racscsi home] # vim / etc/tgt/ targets.conf
Add the following at the end of the file
# iqn name is optional
Backing-store / dev/sdb
Backing-store / dev/sdc
Backing-store / dev/sdd
Backing-store / dev/sde
Backing-store / dev/sdf
Backing-store / dev/sdg
Backing-store / dev/sdh
Backing-store / dev/sdi
Initiator-address 192.168.10.0amp 24 # limits the client address range or specific IP that is allowed to access
Write-cache off # whether to turn the cache on or off
Restart the service so that the modified configuration takes effect.
[root@racscsi home] # / etc/init.d/tgtd restart
Determine if the iscsi server was successful. If the following is displayed, the configuration of iscsi server has been successful.
[root@racscsi home] # tgt-admin-- show
Target 1: iqn.2008-09.com.example:asm
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 1
Initiator: iqn.1994-05.com.redhat:b363811441a
Connection: 0
IP Address: 192.168.10.212
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 2147 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: / dev/sdb
Backing store flags:
. # Intermediate content omitted
LUN: 8
Type: disk
SCSI ID: IET 00010008
SCSI SN: beaf18
Size: 5369 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: / dev/sdi
Backing store flags:
Account information:
ACL information:
192.168.10.0/24
Note: close the IPTABLES on the server to prevent the client from being unable to access it properly.
II. Client mount
The package iscsi-initiator-utils to be installed by the client
[root@rac2 home] # rpm-ivh iscsi-initiator-utils-6.2.0.872-41.el6.x86_64.rpm
Warning: iscsi-initiator-utils-6.2.0.872-41.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... # [100%]
1:iscsi-initiator-utils # # [100%]
Install with the yum command (you need to configure the YUM source yourself)
[root@rac2 home] # yum-y install iscsi-initiator-utils
Start the service and add it to boot.
[root@rac2 Desktop] # / etc/init.d/iscsid start
[root@rac2 Desktop] # chkconfig iscsid on
Discover the shared partition of the server-side iscsi server.
[root@rac2 Desktop] # iscsiadm-mode discovery-type sendtargets-portal 192.168.10.220
192.168.10.220pur3260 iqn.2008-09.com.example:asm
Has been discovered
Log in to the partition shared by iscsi server.
[root@rac2 Desktop] # iscsiadm-m node-T iqn.2008-09.com.example:asm-p 192.168.10.220-l
Logging in to [iface: default, target: iqn.2008-09.com.example:asm, portal: 192.168.10.220 Magne3260] (multiple)
Login to [iface: default, target: iqn.2008-09.com.example:asm, portal: 192.168.10.220 Magne3260] successful.
Then use the fdisk-l command to view the partitions and find that all the shared partitions have been hung up.
[root@rac2 Desktop] # fdisk-l
Disk / dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000586f0
Device Boot Start End Blocks Id System
/ dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/ dev/sda2 39 549 4096000 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/ dev/sda3 549 2611 16567296 83 Linux
Disk / dev/sdb: 2147 MB, 2147483648 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk / dev/sdc: 2147 MB, 2147483648 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk / dev/sdd: 2147 MB, 2147483648 bytes
67 heads, 62 sectors/track, 1009 cylinders
Units = cylinders of 4154 * 512 = 2126848 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk / dev/sde: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk / dev/sdf: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk / dev/sdg: 10.7 GB, 10737418240 bytes
64 heads, 32 sectors/track, 10240 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk / dev/sdh: 5368 MB, 5368709120 bytes
166 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 10292 * 512 = 5269504 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk / dev/sdi: 5368 MB, 5368709120 bytes
166 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 10292 * 512 = 5269504 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Finally, you can format the partition and mount it in the local directory. If you want to achieve boot auto-mount, you need to add records in the fstab file.
Be careful to add the _ netdev parameter, or you will report an error when you restart iscsi server.
Example: / dev/sdb / crs ext4 default,_netdev 0 0
Add:
If the user name and password are configured in the server / etc/tgt/targets.conf file, such as
Backing-store / dev/sdb
Initiator-address 192.168.10.0/24
Incoming grid 123@passwd
Write-cacheoff
In the client / etc/iscsi/iscsid.conf configuration file
You need to add the appropriate account and password.
Node.session.auth.username = grid
Node.session.auth.password = 123@passwd
Discovery.sendtargets.auth.username = grid
Discovery.sendtargets.auth.password = 123@passwd
The above is all the contents of the article "how to build an iscsi-target server in rhel6.3". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!