四、客户端挂载

1、linux客户端

A、安装iscsi initiator

[root@localhost ~]# yum -y install iscsi*

B、启动Initiator服务

[root@localhost ~]# service iscsi start

C、执行iscsi target发现

[root@localhost ~]# iscsiadm -m discovery -t sendtargets -p 119.147.146.246
[确定]动 iscsid:[确定]
119.147.146.246:3260,1 iqn.2001-04.com.example:storage.disk2.sys1.xyz

可以看到“iqn.2001-04.com.example:storage.disk2.sys1.xyz”就是iscsi target的名称,容许所有客户端主机连接iscsi target共享的磁盘

D、挂接iscsi target

[root@localhost ~]# iscsiadm -m node -T iqn.2001-04.com.example:storage.disk2.sys1.xyz -p 119.147.146.61 -l


Logging in to [iface: default, target: iqn.2001-04.com.example:storage.disk2.sys1.xyz, portal: 119.147.146.61,3260] (multiple)
Login to [iface: default, target: iqn.2001-04.com.example:storage.disk2.sys1.xyz, portal: 119.147.146.61,3260] successful.
[root@localhost ~]#
[root@localhost ~]# fdisk -l

Disk /dev/sdd: 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/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

已经挂载成功

F、卸载

[root@localhost ~]# iscsiadm -m node -T iqn.2001-04.com.example:storage.disk2.sys1.xyz -p 119.147.146.61 -u


Logging out of session [sid: 2, target: iqn.2001-04.com.example:storage.disk2.sys1.xyz, portal: 119.147.146.61,3260]
Logout of [sid: 2, target: iqn.2001-04.com.example:storage.disk2.sys1.xyz, portal: 119.147.146.61,3260] successful.
[root@localhost ~]#

2、server2008上挂载

点击:开始--管理工具--iscsi发起程序  到:

在目录那里输入iscsi的IP,点击快速连接就OK。

磁盘3就刚才挂载的,可以像使用本地磁盘一样使用了