Iscsi Target config lv

yyp2009發表於2013-12-24

Iscsi Target config lv
lvcreate -L 20G -n lv_arch vg_orastorage
[root@orastorage rc0.d]# service tgtd status
tgtd (pid 3159 3157) is running...
[root@orastorage rc0.d]# iscsiadm -m discovery --type sendtargets --portal 10.10.22.16
[  OK  ] iscsid: [  OK  ]

[root@orastorage rc0.d]# vi /etc/tgt/targets.conf


        backing-store /dev/vg_orastoreage/lv_arch
        initiator-address 10.10.22.20
        initiator-address 10.10.22.21
        initiator-address 10.10.22.11
        initiator-address 10.10.22.16
"/etc/tgt/targets.conf" 302L, 8144C written

[root@orastorage rc0.d]#  service tgtd reload
Updating SCSI target daemon configuration: [  OK  ]

[root@oratest3 ~]# iscsiadm -m node -T arch -p 10.10.22.16:3260 -l
Logging in to [iface: default, target: arch, portal: 10.10.22.16,3260]
Login to [iface: default, target: arch, portal: 10.10.22.16,3260] successful

[root@oratest3 ~]# iscsiadm -m discovery --type sendtargets --portal 10.10.22.16
10.10.22.16:3260,1 CRS1
10.10.22.16:3260,1 CRS2
10.10.22.16:3260,1 CRS3
10.10.22.16:3260,1 DATA1
10.10.22.16:3260,1 DATA2
10.10.22.16:3260,1 DATA3
10.10.22.16:3260,1 arch


tgtadm --lld iscsi --op new --mode logicalunit --tid 7 --lun 1 -b /dev/vg_orastorage/lv_arch
tgtadm --lld iscsi --op new --mode logicalunit --tid 8 --lun 1 -b /dev/vg_orastorage/lv_ocr

 

/sbin/scsi_id -g -u -d /dev/sdb
/sbin/scsi_id -g -u -d /dev/sdd


partprobe /dev/sdb
partprobe /dev/sdb

udevadm info --query=all --name=asm-arch
udevadm info --query=all --name=asm-ocr

lvs

iscsi --op show --mode target

root@oratest3 ~]# fdisk -l|grep sd
Disk /dev/mapper/vg_oratest3-LogVol05 doesn't contain a valid partition table
Disk /dev/mapper/vg_oratest3-LogVol00 doesn't contain a valid partition table
Disk /dev/mapper/vg_oratest3-LogVol04 doesn't contain a valid partition table
Disk /dev/mapper/vg_oratest3-LogVol01 doesn't contain a valid partition table
Disk /dev/mapper/vg_oratest3-LogVol03 doesn't contain a valid partition table
Disk /dev/mapper/vg_oratest3-LogVol02 doesn't contain a valid partition table
Disk /dev/sdd doesn't contain a valid partition table
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sda: 146.8 GB, 146778685440 bytes
/dev/sda1   *           1          64      512000   83  Linux
/dev/sda2              64       17845   142825472   8e  Linux LVM
Disk /dev/sdc: 97.8 GB, 97847930880 bytes
/dev/sdc1               1       11896    95554588+  83  Linux
Disk /dev/sdd: 2147 MB, 2147483648 bytes
Disk /dev/sdg: 97.9 GB, 97864381440 bytes
/dev/sdg1               1       11898    95570653+  83  Linux
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
Disk /dev/sdf: 26.8 GB, 26843545600 bytes
/dev/sdf1               1       25600    26214384   83  Linux
Disk /dev/sdi: 5368 MB, 5368709120 bytes
/dev/sdi1               1        1018     5238597   83  Linux
Disk /dev/sde: 97.8 GB, 97847898624 bytes
/dev/sde1               1       11895    95546556   83  Linux
Disk /dev/sdh: 21.5 GB, 21474836480 bytes
/dev/sdh1               1       20480    20971504   83  Linux
[root@oratest3 ~]# fdisk /dev/sdc
……
[root@oratest3 ~]# partprobe /dev/sdb
[root@oratest3 ~]# partprobe /dev/sdd
[root@oratest3 ~]# start_udev
Starting udev: [  OK  ]
[root@oratest3 ~]# udevadm info --query=all --name=asm-arch

1)iscsiadm -m session -R
-R引數可以用來掃描session,比如新增了一個新的卷,就不用logout/login,直接rescan一下;

2)iscsadm -m session -r [session id] -o new
用於對同一個session增加新的session,類似於mpio啦;
session id可以通過iscsiadm -m session檢視到,比如:
[root@test1 ~]# iscsiadm -m session
tcp: [100] 192.168.73.1:3260,7 iqn.test1:0
tcp: [101] 192.168.73.1:3260,7 iqn.test1:0
藍色字型部分就是session id

[root@oratest3 dev]# iscsiadm -m nodeiscsiadm -m session -R
Rescanning session [sid: 3, target: arch, portal: 10.10.22.16,3260]
Rescanning session [sid: 6, target: ocr, portal: 10.10.22.16,3260]
[root@oratest3 dev]#
[root@oratest3 dev]#
[root@oratest3 dev]# iscsiadm -m session -R
Rescanning session [sid: 3, target: arch, portal: 10.10.22.16,3260]
Rescanning session [sid: 6, target: ocr, portal: 10.10.22.16,3260]
[root@oratest3 dev]#
[root@oratest3 dev]#

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/13750068/viewspace-1064160/,如需轉載,請註明出處,否則將追究法律責任。

相關文章