Chinaunix首页 | 论坛 | 博客
  • 博客访问: 252983
  • 博文数量: 38
  • 博客积分: 2093
  • 博客等级: 大尉
  • 技术积分: 432
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-01 10:29
文章分类

全部博文(38)

文章存档

2011年(10)

2010年(28)

我的朋友

分类: LINUX

2010-04-30 10:33:40

deb261:~# apt-get install open-iscsi
Reading package lists… Done
Building dependency tree… Done
The following NEW packages will be installed
open-iscsi
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/104kB of archives.
After unpacking 340kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
open-iscsi
Install these packages without verification [y/N]? y
Selecting previously deselected package open-iscsi.
(Reading database … 34744 files and directories currently installed.)
Unpacking open-iscsi (from …/open-iscsi_1.0.485-3_i386.deb) …
Setting up open-iscsi (1.0.485-3) …
Starting iSCSI initiator service: succeeded.

也可以从源代码安装open-iscsi, 从下载最新的open-iscsi原代码, 目前最新的版本为485. 解压后运行make; make install可安装open-iscsi.

2.2 启动open-iscsi后台服务. 如果使用apt-get的方式安装open-iscsi, 安装完成后, dpkg会自动启动open-iscsi服务, 如果是从原代码安装open-iscsi, 则需要手动启动open-iscsi服务.

deb261:~# /etc/init.d/open-iscsi start
Starting iSCSI initiator service: succeeded.

dmesg中可以看到scsi_transport注册的信息.

iscsi: registered transport (tcp)

2.3 配置open-iscsi, 使其联接到iscsi target

2.3.1 设置open-iscsi使用的target

deb261:~# iscsiadm -m discovery -t sendtargets -p 10.1.0.11:3260
[045e0b] 10.1.0.11:3260,1 iqn.2001-04.com.example:storage.disk2.sys1.xyz

其中, 10.1.0.11是iscsi target的ip地址, 3260是iscsi target使用的端口, 默认为3260, 如果使用默认端口则可以省略”:3260″. 输出结果中045e0b是这个iscsi target的record id, iqn.2001-04.com.example:storage.disk2.sys1.xyz为iscsi target的名称.

2.3.2 查看open-iscsi可以使用的target

deb261:~# iscsiadm -m node
[045e0b] 10.1.0.11:3260,1 iqn.2001-04.com.example:storage.disk2.sys1.xyz

2.3.4 登录到iscsi target

deb261:~# iscsiadm -m node -r 045e0b -l

登录成功后, 可以使用fdisk -l查看到iscsi磁盘

deb261:~# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2500 20081218+ 83 Linux
/dev/sda2 2501 2610 883575 5 Extended
/dev/sda5 2501 2610 883543+ 82 Linux swap / Solaris

Disk /dev/sdb: 8589 MB, 8589934592 bytes
64 heads, 32 sectors/track, 8192 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 8192 8388592 83 Linux

Disk /dev/sdc: 1073 MB, 1073741824 bytes
34 heads, 61 sectors/track, 1011 cylinders
Units = cylinders of 2074 * 512 = 1061888 bytes

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

dmesg输出的末尾会提示iscsi磁盘的注册信息.

scsi1 : iSCSI Initiator over TCP/IP, v.0.3
Vendor: IET Model: VIRTUAL-DISK Rev: 0
Type: Direct-Access ANSI SCSI revision: 04
SCSI device sdb: 16777216 512-byte hdwr sectors (8590 MB)
sdb: Write Protect is off
sdb: Mode Sense: 77 00 00 08
SCSI device sdb: drive cache: write back
SCSI device sdb: 16777216 512-byte hdwr sectors (8590 MB)
sdb: Write Protect is off
sdb: Mode Sense: 77 00 00 08
SCSI device sdb: drive cache: write back
sdb: sdb1
sd 1:0:0:0: Attached scsi disk sdb
Vendor: IET Model: VIRTUAL-DISK Rev: 0
Type: Direct-Access ANSI SCSI revision: 04
SCSI device sdc: 2097152 512-byte hdwr sectors (1074 MB)
sdc: Write Protect is off
sdc: Mode Sense: 77 00 00 08
SCSI device sdc: drive cache: write back
SCSI device sdc: 2097152 512-byte hdwr sectors (1074 MB)
sdc: Write Protect is off
sdc: Mode Sense: 77 00 00 08
SCSI device sdc: drive cache: write back
sdc: unknown partition table
sd 1:0:0:1: Attached scsi disk sdc

2.3.5 不需要使用是可以注销iscsi登录.

deb261:~# iscsiadm -m node -r 045e0b -u
deb261:~# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2500 20081218+ 83 Linux
/dev/sda2 2501 2610 883575 5 Extended
/dev/sda5 2501 2610 883543+ 82 Linux swap / Solaris

阅读(2694) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~