Difference between revisions of "ISCSI initiator (简体中文)"

From ArchWiki
Jump to navigation Jump to search
Line 5: Line 5:
 
{{Related|iSCSI Boot}}
 
{{Related|iSCSI Boot}}
 
{{Related articles end}}
 
{{Related articles end}}
[[en:iSCSI initiator]]
+
[[en:ISCSI Initiator]]
 
{{TranslationStatus (简体中文)|ISCSI_Initiator|2015-05-10|332214}}
 
{{TranslationStatus (简体中文)|ISCSI_Initiator|2015-05-10|332214}}
 
{{Translateme (简体中文)}}
 
{{Translateme (简体中文)}}
With [[Wikipedia:iSCSI]] you can access storage over an IP-based network.
+
来自 [[Wikipedia:iSCSI|维基百科:iSCSI]]可以通过基于 IP 的网络访问存储设备。
  
The exported storage entity is the '''[[iSCSI Target|target]]''' and the importing entity is the '''initiator'''.
+
提供受访的实体是 目标(target),发起访问的实体称为 发起者(initiator)。
  
This article describes how to access an iSCSI target with the [http://open-iscsi.org/ Open-iSCSI] initiator.
+
本文讲述如何通过[http://open-iscsi.org/ Open-iSCSI] initiator访问iSCSI target。
  
 
== 安装 ==
 
== 安装 ==
[[pacman|Install]] the {{Pkg|open-iscsi}} package from the [[official repositories]].
+
可以从 [[official repositories|官方源]] [[pacman|安装]] 软件包。
  
{{Note|An older initiator, [http://sourceforge.net/projects/linux-iscsi/ Linux-iSCSI], was merged with Open-iSCSI in April 2005.
+
{{注意|旧版的 initiator,[http://sourceforge.net/projects/linux-iscsi/ Linux-iSCSI] 已经于二零零五年四月合并进 Open-iSCSI
 
This should not be confused with [http://linux-iscsi.org/ linux-iscsi.org], the website for the LIO [[iSCSI Target|target]].}}
 
This should not be confused with [http://linux-iscsi.org/ linux-iscsi.org], the website for the LIO [[iSCSI Target|target]].}}
  
 
== 概览 ==
 
== 概览 ==
The following diagram shows how the Components work together. A more detailed version can be found here: [http://www.open-iscsi.org/docs/open-iscsi-0.jpg Open-iSCSI modules]
+
下图显示各组件是如何协同工作的。更详细的版本参见:[http://www.open-iscsi.org/docs/open-iscsi-0.jpg Open-iSCSI 模块]
 
{{bc|<nowiki>
 
{{bc|<nowiki>
 
  +-------------------------------------------------------+             
 
  +-------------------------------------------------------+             
Line 43: Line 43:
 
</nowiki>}}
 
</nowiki>}}
  
From the Open-iSCSI [http://www.open-iscsi.org/docs/README README]:
+
来自 Open-iSCSI [http://www.open-iscsi.org/docs/README README]:
  
Persistent configuration is implemented as a DBM database, which contains two tables:
+
持久化的配置通过一个 DBM 数据库实现,它包括两个表:
* Discovery table (/etc/iscsi/send_targets)
+
* 发现表(Discovery table)(/etc/iscsi/send_targets)
* Node table (/etc/iscsi/nodes)
+
* 节点表(Node table)(/etc/iscsi/nodes)
  
 
== 配置 ==
 
== 配置 ==
 
=== 启动服务 ===
 
=== 启动服务 ===
{{ic|iscsid}} is managed by a systemd Unit.
+
{{ic|iscsid}} 由一个 systemd单元 来管理。
  
Start {{ic|open-iscsi.service}} [[systemd#Using units|using systemd]].
+
[[systemd#Using units|用 systemd]] 启动 {{ic|open-iscsi.service}}
  
{{Out of date|The following advice about /etc/conf.d/open-iscsi might be out of date, see discussion page}}  
+
{{Out of date|下列有关 /etc/conf.d/open-iscsi 的建议已过时,参阅讨论页面}}  
 
You only have to include the IP of the [[iSCSI Target|target]] as {{ic|SERVER}} in {{ic|/etc/conf.d/open-iscsi}} at the client.
 
You only have to include the IP of the [[iSCSI Target|target]] as {{ic|SERVER}} in {{ic|/etc/conf.d/open-iscsi}} at the client.
  
Line 65: Line 65:
 
=== 登录到有效的目标 ===
 
=== 登录到有效的目标 ===
 
{{bc|# iscsiadm -m node -L all}}
 
{{bc|# iscsiadm -m node -L all}}
or login to specific target
+
或者,登录到指定目标
 
{{bc|<nowiki># iscsiadm -m node --targetname=<targetname> --login</nowiki>}}
 
{{bc|<nowiki># iscsiadm -m node --targetname=<targetname> --login</nowiki>}}
  
logout:
+
登出:
 
{{bc|# iscsiadm -m node -U all}}
 
{{bc|# iscsiadm -m node -U all}}
  
 
=== 信息 ===
 
=== 信息 ===
For running session
+
对于运行中的会话
 
{{bc|# iscsiadm -m session -P 3}}
 
{{bc|# iscsiadm -m session -P 3}}
The last line of the above command will show the name of the attached dev e.g
+
上面命令输出的最后一行会显示连接到的设备名,比如
 
{{bc|Attached scsi disk '''sdd''' State: running}}
 
{{bc|Attached scsi disk '''sdd''' State: running}}
  
For the known nodes
+
对于已知节点
 
{{bc|# iscsiadm -m node}}
 
{{bc|# iscsiadm -m node}}
  
=== 在线修改卷容量 ===
+
=== 在线修改卷大小 ===
If the iscsi blockdevice contains a partitiontable, you will not be able to do an online resize. In this case you have to unmount the filesystem and alter the size of the affected partition.
+
如果 iscsi 块设备包含一个分区表,则不能在线修改卷大小。这种情况下必须首先卸载文件系统,然后再调整相关分区的大小。
# Rescan active nodes in current session {{bc|# iscsiadm -m node -R}}
+
# 重新扫描当前会话中的活动节点。{{bc|# iscsiadm -m node -R}}
# If you use multipath, you also have to rescan multipath volume information. {{bc|# multipathd -k"resize map sdx"}}
+
# 在多路径环境中,也必须重新扫描多路径下的卷信息。{{bc|# multipathd -k"resize map sdx"}}
# Finally resize the filesystem. {{bc|# resize2fs /dev/sdx}}
+
# 完成后再调整文件系统大小。{{bc|# resize2fs /dev/sdx}}
  
 
== 提示与排错 ==
 
== 提示与排错 ==
You can also check where the attached iSCSI devices are located in the /dev tree with {{ic|ls -lh /dev/disk/by-path/* | grep ip}}.
+
可以用下列命令检查已连接的 iSCSI 设备在 /dev 设备树中的位置:
 +
{{ic|ls -lh /dev/disk/by-path/* | grep ip}}
  
At the server (target) you might need to include the client iqn from {{ic|/etc/iscsi/initiatorname.iscsi}} in the acl configuration.
+
在服务器端(target)的 acl 配置中应当包含客户端的 iqn(位于客户端的 {{ic|/etc/iscsi/initiatorname.iscsi}})。
  
Many of the {{ic|iscsiadm}} operations require that the iSCSI daemon {{ic|iscsid}} is running. To verify that this is the case,  
+
{{ic|iscsiadm}} 的许多操作要求 iSCSI 的守护进程 {{ic|iscsid}} 处于运行状态。To verify that this is the case,  
 
[[systemd#Using units|check the status]] of the {{ic|open-iscsi.service}}.
 
[[systemd#Using units|check the status]] of the {{ic|open-iscsi.service}}.
  
 
== 参阅 ==
 
== 参阅 ==
 
* [[iSCSI Boot]] Booting Arch Linux with / on an iSCSI target.
 
* [[iSCSI Boot]] Booting Arch Linux with / on an iSCSI target.

Revision as of 11:36, 10 May 2015

翻译状态: 本文是英文页面 ISCSI_Initiator翻译,最后翻译时间:2015-05-10,点击这里可以查看翻译后英文页面的改动。

Tango-preferences-desktop-locale.png本页面需要更新翻译,内容可能已经与英文脱节。要贡献翻译,请访问简体中文翻译组Tango-preferences-desktop-locale.png

附注: please use the first argument of the template to provide more detailed indications.

来自 维基百科:iSCSI可以通过基于 IP 的网络访问存储设备。

提供受访的实体是 目标(target),发起访问的实体称为 发起者(initiator)。

本文讲述如何通过Open-iSCSI initiator访问iSCSI target。

安装

可以从 官方源 安装 软件包。

注意: 旧版的 initiator,Linux-iSCSI 已经于二零零五年四月合并进 Open-iSCSI 。 This should not be confused with linux-iscsi.org, the website for the LIO target.

概览

下图显示各组件是如何协同工作的。更详细的版本参见:Open-iSCSI 模块

 +-------------------------------------------------------+             
 | Targets & Sessions configuration Database (DBM based) |             
 +-------------------------------------------------------+             
                                                                       
 +--------------------------+     +----------------------------------+ 
 | iscsiadm                 |     | iscsid: iSCSI daemon             | 
 |                          |     |                                  | 
 |  * Command line tool     |<--->|  * Implements Session management | 
 |  * Manages database of   |     |  * Communicates with iscsiadm    | 
 |    sessions and targets  |     |    and iscsi kernel modules      | 
 +--------------------------+     +---------------+------------------+ 
                                                  |                    
 User space                                       |                    
- - - - - - - - - - - - - - - - - - - - - - - - - | - - - - - - - - - -
 Kernel                                           v                    
         +-----------------------------------------------------------+ 
         | kernel modules: scsi_transport_iscsi, iscsi_tcp, libiscsi | 
         +-----------------------------------------------------------+ 

来自 Open-iSCSI README:

持久化的配置通过一个 DBM 数据库实现,它包括两个表:

  • 发现表(Discovery table)(/etc/iscsi/send_targets)
  • 节点表(Node table)(/etc/iscsi/nodes)

配置

启动服务

iscsid 由一个 systemd单元 来管理。

用 systemd 启动 open-iscsi.service

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: 下列有关 /etc/conf.d/open-iscsi 的建议已过时,参阅讨论页面 (Discuss in Talk:ISCSI initiator (简体中文)#)

You only have to include the IP of the target as SERVER in /etc/conf.d/open-iscsi at the client.

发现目标

# iscsiadm -m discovery -t sendtargets -p <portalip>

删除废旧目标

# iscsiadm -m discovery -p <portalip> -o delete

登录到有效的目标

# iscsiadm -m node -L all

或者,登录到指定目标

# iscsiadm -m node --targetname=<targetname> --login

登出:

# iscsiadm -m node -U all

信息

对于运行中的会话

# iscsiadm -m session -P 3

上面命令输出的最后一行会显示连接到的设备名,比如

Attached scsi disk sdd State: running

对于已知节点

# iscsiadm -m node

在线修改卷大小

如果 iscsi 块设备包含一个分区表,则不能在线修改卷大小。这种情况下必须首先卸载文件系统,然后再调整相关分区的大小。

  1. 重新扫描当前会话中的活动节点。
    # iscsiadm -m node -R
  2. 在多路径环境中,也必须重新扫描多路径下的卷信息。
    # multipathd -k"resize map sdx"
  3. 完成后再调整文件系统大小。
    # resize2fs /dev/sdx

提示与排错

可以用下列命令检查已连接的 iSCSI 设备在 /dev 设备树中的位置: ls -lh /dev/disk/by-path/*

在服务器端(target)的 acl 配置中应当包含客户端的 iqn(位于客户端的 /etc/iscsi/initiatorname.iscsi)。

iscsiadm 的许多操作要求 iSCSI 的守护进程 iscsid 处于运行状态。To verify that this is the case, check the status of the open-iscsi.service.

参阅

  • iSCSI Boot Booting Arch Linux with / on an iSCSI target.