RHCA> learning> 3> ISCSIRHEL5

Source: Internet
Author: User
I. Configure ISCSITarget Server 1. Install ISCSITarget Software Package CentOS, RHEL5 [root @ server1 ~] # Yuminstalliscsi-initiator-utils-y [root @ server1 ~] # Yuminstallscsi-target-utils-y2. Add two new partitions/dev/sdb1,/dev/sd

I. Configure the ISCSI Target server

1. Install the ISCSI Target Software Package

CentOS, RHEL5

[Root @ server1 ~] # Yum install iscsi-initiator-utils-y

[Root @ server1 ~] # Yum install scsi-target-utils-y

2. Two new partitions are added:/dev/sdb1 and/dev/sdb2 are shared using ISCSI.

[Root @ server1 ~] # Fdisk-l

Disk/dev/sda: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System

/Dev/sda1*1 13 104391 83 Linux

/Dev/sda2 14 1044 8281507 + 8e Linux LVM

Disk/dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System

/Dev/sdb1 1 512 4112608 + 83 Linux

/Dev/sdb2 513 1044 4273290 83 Linux

[Root @ server1 ~] #

3. Start the server tgtd

[Root @ server1 ~] # Chkconfig tgtd on

[Root @ server1 ~] # Service tgtd start

Starting SCSI target daemon: [OK]

[Root @ server1 ~] #

4. Use tgtadm to define the qualified of iscsi target

Root @ server1 ~] # Tgtadm -- lld iscsi -- op new -- mode target -- tid 1-T iqn.2009-12.com.example.com. disk1

[Root @ server1 ~] # Tgtadm -- lld iscsi -- op new -- mode target -- tid 2-T iqn.2009-12.com.example.com. disk2

5. Use tgtadm to add partitions to the created target

[Root @ server1 ~] # Tgtadm -- lld iscsi -- op new -- mode logicalunit -- tid 1 -- lun 1-B/dev/sdb1

[Root @ server1 ~] # Tgtadm -- lld iscsi -- op new -- mode logicalunit -- tid 2 -- lun 1-B/dev/sdb2

6. Use tgtadm to allow Client Access

[Root @ server1 ~] # Tgtadm -- lld iscsi -- op bind -- mode target -- tid 1-I ALL

[Root @ server1 ~] # Tgtadm -- lld iscsi -- op bind -- mode target -- tid 2-I ALL

7. Use tgtadm to verify the target logical volume

[Root @ server1 ~] # Tgtadm -- lld iscsi -- op show -- mode target | grep Target

Target 1: iqn.2009-12.com.example.com. disk1

Target 2: iqn.2009-12.com.example.com. disk2

[Root @ server1 ~] #

8. Add the above command to the/etc/rc. d/rc. local file to be valid after restart.

2. Configure the ISCSI Client

1. [root @ station1 ~] # Chkconfig iscsi on

[Root @ station1 ~] # Service iscsi start

Iscsid (pid 1705 1704) is running...

Set iSCSI target: iscsiadm: No records found!

[OK]

[Root @ station1 ~] #

2. ISCSI server resources discovered

[Root @ station1 ~] # Iscsiadm-m discovery-t sendtargets-p 192.168.0.254

192.168.0.254: 3260,1 iqn.2009-12.com.example.com. disk1

192.168.0.254: 3260,1 iqn.2009-12.com.example.com. disk2

[Root @ station1 ~] #

3. log on to the target using iscsiadm

[Root @ station1 ~] # Iscsiadm-m node-T iqn.2009-12.com.example.com. disk1-p 192.168.0.254-l

Logging in to [iface: default, target: iqn.2009-12.com.example.com. disk1, portal: 192.168.0.254, 3260]

Login to [iface: default, target: iqn.2009-12.com.example.com. disk1, portal: 192.168.0.254, 3260]: successful

[Root @ station1 ~] # Iscsiadm-m node-T iqn.2009-12.com.example.com. disk2-p 192.168.0.254-l

Logging in to [iface: default, target: iqn.2009-12.com.example.com. disk2, portal: 192.168.0.254, 3260]

Login to [iface: default, target: iqn.2009-12.com.example.com. disk2, portal: 192.168.0.254, 3260]: successful

[Root @ station1 ~] #

4. view the current disk partition. You can see the newly added two partitions:/dev/sdb/dev/sdc.

[Root @ station1 ~] # Fdisk-l

Disk/dev/sda: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System

/Dev/sda1*1 13 104391 83 Linux

/Dev/sda2 14 1044 8281507 + 8e Linux LVM

Disk/dev/sdb: 4211 MB, 4211311104 bytes

130 heads, 62 sectors/track, 1020 cylinders

Units = cylinders of 8060*512 = 4126720 bytes

Disk/dev/sdb doesn' t contain a valid partition table

Disk/dev/sdc: 4375 MB, 4375848960 bytes

135 heads, 62 sectors/track, 1021 cylinders

Units = cylinders of 8370*512 = 4285440 bytes

Disk/dev/sdc doesn' t contain a valid partition table

[Root @ station1 ~] #

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.