San's iSCSI NAS share build operation

Source: Internet
Author: User

Lab Environment:

System: centos-6.6

kernel:2.6.32

Target End: scsi-target-utils-1.0.24-16.el6.x86_64

ip:192.168.150.138

Initiator End: iscsi-initiator-utils-6.2.0.873-13.el6.x86_64

ip:192.168.150.139


I. Target-side build storage environment

Add seven hard drives, four blocks for RAID5, three for LVM.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/29/wKiom1SqdYCx44KeAAC4ksZboAY359.jpg "title=" Disk.png "alt=" Wkiom1sqdycx44keaac4kszboay359.jpg "/>

To load a hard disk dynamically:

LINUX5 Load Mode

echo "scsi add-single-device 0 0 1 0" >/PROC/SCSI/SCSI

linux6 Load Mode

echo "---" >/sys/class/scsi_host/host2/scan


[Email protected] ~]# cat/proc/partitions #查看硬盘被加载

Major Minor #blocks name


8 0 20971520 SDA

8 1 512000 sda1

8 2 20458496 Sda2

253 0 18391040 dm-0

253 1 2064384 dm-1

8 1048576 SDB

8 1048576 SDC

8 1048576 SDD

8 1048576 SDE

8 1048576 SDF

8 1048576 SDG

8 1048576 SDH


    1. Do RAID5:

[Email protected] ~]# mdadm-cv/dev/md0-a YES-N3-L5-X1/DEV/SD[B-E]

Mdadm:layout defaults to Left-symmetric

Mdadm:layout defaults to Left-symmetric

Mdadm:chunk size defaults to 512K

Mdadm:size set to 1047552K

Mdadm:defaulting to version 1.2 metadata

Mdadm:array/dev/md0 started.


[Email protected] ~]# mdadm-q/dev/md0

/dev/md0:2046.34mib RAID5 3 devices, 1 spare. Use the Mdadm--detail for more detail.


2. Do LVM:

[[email protected] ~]# Pvcreate/dev/sd[f-h]

Physical volume "/DEV/SDF" successfully created

Physical volume "/DEV/SDG" successfully created

Physical volume "/DEV/SDH" successfully created


[Email protected] ~]# vgcreate dragonvg/dev/sd[f-h]

Volume Group "DRAGONVG" successfully created


[Email protected] ~]# lvcreate-l 2.8g-n DRAGONLV DRAGONVG

Rounding up size to full physical extent 2.80 GiB

Logical volume "Peipeilv" created


Two. Target Side releases iSCSI:

[email protected] ~]# Yum install scsi-target-utils

[[Email protected] ~]# service TGTD start

Booting SCSI target daemon: [OK]


Making a Raid object

[Email protected] ~]# tgtadm-l iscsi-o new-m target-t 1-t iqn.2015-1.dragon.com:raid

Allocating storage space

[Email protected] ~]# tgtadm--lld iscsi-o new-m logicalunit-t 1-l 1-b/dev/md0

Specify the clients that can be accessed

[Email protected] ~]# tgtadm--lld iscsi-o bind-m target-t 1-i 192.168.150.139

[Email protected] ~]# tgtadm--lld iscsi-o bind-m target-t 1-i 192.168.150.130 #可以指定多个访问IP


View the created iSCSI target

[Email protected] ~]# tgtadm-l iscsi-o show-m Target

Target 1:iqn.2015-1.dragon.com:raid

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, 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:2145 MB, Block size:512

Online:yes

Removable Media:no

Prevent Removal:no

Readonly:no

Backing store Type:rdwr

Backing store Path:/dev/md0

Backing Store Flags:

Account information:

ACL Information:

192.168.150.139

192.168.150.130


Publish target for LVM

[Email protected] ~]# tgtadm-l iscsi-o new-m target-t 2-t IQN.2015-1.DRAGON.COM:LVM

[Email protected] ~]# tgtadm--lld iscsi-o new-m lu-t 2-l 1-b/DEV/DRAGONVG/DRAGONLV

[Email protected] ~]# tgtadm--lld iscsi-o bind-m target-t 2-i 192.168.150.139


You can also publish the target by configuring/etc/tgt/targets.conf

<target iqn.2015-1.dragon.com:raid>

Backing-store/dev/md0

Initiator-address 192.168.150.139

</target>

<target iqn.2015-1.dragon.com:lvm>

Backing-store/dev/dragonvg/dragonlv

Initiator-address 192.168.150.139

</target>


Three. Client publishing and mounting iSCSI:

[email protected] ~]# Yum install iscsi-initiator-utils lsscsi #安装iscsi-initiator

[[Email protected] ~]# service iSCSI start #启动服务


[Email protected] ~]# iscsiadm-m discovery-t sendtargets-p 192.168.150.138 #查找192. Available objects for 168.150.138 released iSCSI publications

Starting iscsid: [OK]

192.168.150.138:3260,1 Iqn.2015-1.dragon.com:raid

192.168.150.138:3260,1 IQN.2015-1.DRAGON.COM:LVM


[Email protected] ~]# iscsiadm-m node-t iqn.2015-1.dragon.com:raid--login #连接存储对象iqn. 2015-1.dragon.com:raid

Logging in to [Iface:default, Target:iqn.2015-1.dragon.com:raid, portal:192.168.150.138,3260] (multiple)

Login to [Iface:default, Target:iqn.2015-1.dragon.com:raid, portal:192.168.150.138,3260] successful.


[Email protected] ~]# iscsiadm-m node-t iqn.2015-1.dragon.com:lvm--login #连接存储对象iqn. 2015-1.DRAGON.COM:LVM

Logging in to [Iface:default, TARGET:IQN.2015-1.DRAGON.COM:LVM, portal:192.168.150.138,3260] (multiple)

Login to [Iface:default, TARGET:IQN.2015-1.DRAGON.COM:LVM, portal:192.168.150.138,3260] successful.


[Email protected] ~]# LSSCSI #可以看到本机多了两块虚拟硬盘sdb和sdc

[1:0:0:0] CD/DVD Necvmwar VMware IDE CDR10 1.00/dev/sr0

[2:0:0:0] disk vmware, VMware Virtual S 1.0/DEV/SDA

[3:0:0:0] Storage IET Controller 0001-

[3:0:0:1] Disk IET virtual-disk 0001/dev/sdb

[4:0:0:0] Storage IET Controller 0001-

[4:0:0:1] Disk IET virtual-disk 0001/DEV/SDC



Partitioning and formatting

[Email protected] ~]# Fdisk/dev/sdb

N

P

1

[Enter]

[Enter]

W

[Email protected] ~]# FDISK/DEV/SDC

N

P

1

[Enter]

[Enter]

W

[Email protected] ~]# mkfs-t EXT3/DEV/SDB1

[Email protected] ~]# mkfs-t EXT3/DEV/SDC1


Mount succeeded

[Email protected] ~]# Mkdir/test1

[Email protected] ~]# Mkdir/test2

[Email protected] ~]# Mount/dev/sdb1/test1

[Email protected] ~]# Mount/dev/sdc1/test2


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/58/26/wKioL1Sqea3C3B6yAAF0Sx9bUxU454.jpg "title=" Iscsi.png "alt=" Wkiol1sqea3c3b6yaaf0sx9buxu454.jpg "/>


This article is from the "Dragon Love Xue qi" blog, please make sure to keep this source http://dragon123.blog.51cto.com/9152073/1599412

San's iSCSI NAS share build operation

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.