iSCSI节点名称有两种格式,即 iqn-type 格式和 eui-type 格式。
iqn-type的格式为:
iqn.yyyy-mm.backward_naming_authority:unique_device_name
在Linux上的格式为:
iqn.1987-05.com.cisco:RandomNumber
通常我们可以把RandomNumber更改为具有意义的名称如主机名称等。
缺省的,生成的节点名称可以在/etc/initiatorname.iscsi 得到.
InitiatorName=iqn.1987-05.com.cisco:01.ed671bf29e
我们可以修改为:
InitiatorName=iqn.1987-05.com.cisco:test2
重新启动iscsi服务后,Netapp端就能够正确识别initiator.
此时可以从主机上获得相关SCSI设备信息:
iscsi-sfnet: Loading iscsi_sfnet version 4:0.1.11-1
iscsi-sfnet: Control device major number 254
iscsi-sfnet:host3: Session established
scsi3 : SFNet iSCSI driver
scsi: unknown device type 31
Vendor: NETAPP Model: LUN Rev: 0.2
Type: Unknown ANSI SCSI revision: 04
Vendor: NETAPP Model: LUN Rev: 0.2
Type: Direct-Access ANSI SCSI revision: 04
SCSI device sda: 41943040 512-byte hdwr sectors (21475 MB)
SCSI device sda: drive cache: write through
sda: sda1 sda2
Attached scsi disk sda at scsi3, channel 0, id 0, lun 1
可以通过fdisk来分区使用iscsi设备:
[root@test2 ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 20480.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sda: 21.4 GB, 21474836480 bytes
64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 3907 4000752 83 Linux
/dev/sda2 3908 20480 16970752 83 Linux
Command (m for help): q
使用iscsi-ls命令可以看到更为详细的磁盘信息:
[root@test2 ~]# iscsi-ls -l
*******************************************************************************
SFNet iSCSI Driver Version ...4:0.1.11(12-Jan-2005)
*******************************************************************************
TARGET NAME : iqn.1992-08.com.netapp:sn.84192734
TARGET ALIAS :
HOST ID : 3
BUS ID : 0
TARGET ID : 0
TARGET ADDRESS : 172.16.35.228:3260,1
SESSION STATUS : ESTABLISHED AT Tue Nov 15 09:46:27 CST 2005
SESSION ID : ISID 00023d000001 TSIH 113
DEVICE DETAILS:
---------------
LUN ID : 0
Vendor: NETAPP Model: LUN Rev: 0.2
Type: ANSI SCSI revision: 04
LUN ID : 1
Vendor: NETAPP Model: LUN Rev: 0.2
Type: Direct-Access ANSI SCSI revision: 04
page83 type3: 60a98000686f6c504f34314e45774239
page80: 686f6c504f34314e457742390a
Device: /dev/sda
*******************************************************************************