我已在磁盘上创建 Linux LVM 分区,并希望通过 iSCSI 在网络上共享它。但是,使用 iscsiadm 无法访问目标(无论是从本地还是远程)。设置如下所示。
有人知道我无法连接/发现我的 iSCSI 目标的原因吗?(如果您需要更多信息,请告诉我。)
在我的设置中,node01 在 Proxmox VE 3.1(Debian 7)上运行,其 DNS 名称为 node01.domain.name,静态 IP 地址为 192.168.0.1:
$ Linux node01 2.6.32-23-pve #1 SMP Tue Aug 6 07:04:06 CEST 2013 x86_64 GNU/Linux
创建LVM卷组:
$ fdisk /dev/sdf
Command (m for help): p
Disk /dev/sdf: 2000.4 GB, 2000398934016 bytes
81 heads, 63 sectors/track, 765633 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9f0d1cbd
Device Boot Start End Blocks Id System
/dev/sdf1 2048 3907029167 1953513560 8e Linux LVM
Command (m for help): q
$ pvcreate /dev/sdf1
Physical volume "/dev/sdf1" successfully created
$ vgcreate myvg /dev/sdf1
Volume group "myvg" successfully created
iSCSI 目标设置:
$ sudo apt-get install iscsitarget
Then I have changed the configuration files as follows ...
$ more /etc/default/iscsitarget
ISCSITARGET_ENABLE=true
# ietd options
# See ietd(8) for details
ISCSITARGET_OPTIONS=""
$ more /etc/iet/ietd.conf
Target iqn.2099-12.name.domain:storage01.lun1
Lun 0 Path=/dev/sdf1,Type=blockio
Alias LUN1
$ more /etc/iet/initiators.allow
#ALL ALL
iqn.2099-12.name.domain:storage01.lun1 192.168.0.1, 192.168.0.2, 192.168.0.3, 192.168.0.4, 192.168
.0.5, 192.168.0.6
$ /etc/init.d/iscsitarget restart
Removing iSCSI enterprise target devices: :.
Removing iSCSI enterprise target modules: :.
Starting iSCSI enterprise target service:.
.
iSCSI 测试:
$ iscsiadm -m discovery -t st -p node01.domain.name
iscsiadm: cannot make connection to 192.168.0.1: Connection refused
iscsiadm: cannot make connection to 192.168.0.1: Connection refused
iscsiadm: cannot make connection to 192.168.0.1: Connection refused
iscsiadm: cannot make connection to 192.168.0.1: Connection refused
iscsiadm: cannot make connection to 192.168.0.1: Connection refused
iscsiadm: cannot make connection to 192.168.0.1: Connection refused
iscsiadm: connection login retries (reopen_max) 5 exceeded
iscsiadm: Could not perform SendTargets discovery: encountered connection failure
答案1
这并不是对我自己的问题的粗鲁回答,而是我的真正‘解决方案’:
apt-get purge iscsitarget
apt-get install tgt
# Unfortunately, on my version of Proxmox VE there is no init.d script to start and stop tgtd. As a consequence, I need to go nasty ways of workarounds to start and stop tgtd on startup/shutdown/restart. See below:
/usr/sbin/tgtd
tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2099-12.name.domain:storage01
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdf1
tgtadm --lld iscsi --op bind --mode target --tid 1 -I 192.168.0.1, 192.168.0.2, 192.168.0.3, 192.168.0.4, 192.168
.0.5, 192.168.0.6
# To see if everything is configured correctly, use this:
tgtadm --lld iscsi --op show --mode target
在发起方,执行以下操作:
iscsiadm --mode discovery --type sendtargets --portal 192.168.0.1
# Shows this output: 192.168.0.1:3260,1 iqn.2099-12.name.domain:storage01
# This creates a volume /dev/sdg and partition /dev/sdg1
iscsiadm --mode node --targetname iqn.2099-12.name.domain:storage01 --portal 192.168.0.1:3260 --login
欲了解更多信息,请参见:http://www.cyberciti.biz/tips/howto-setup-linux-iscsi-target-sanwith-tgt.html
为了使其永久生效,请在目标端使用以下命令:
tgtadm --dump > /etc/tgt/targets.conf
# Add this to /etc/rc.local
/usr/sbin/tgtd
tgt-admin --execute
要进行干净的“注销”,请将其添加到启动器端关机脚本中
# Some code to turn off your disk users
iscsiadm --mode node --targetname iqn.2099-12.name.domain:storage01 --portal 192.168.0.1:3260 --logoff
rm /dev/sdg
答案2
我也遇到了同样的问题。此 wiki 帖子修复了此问题:
http://forum.proxmox.com/threads/14029-iSCSI-target-stopped-working-when-upgrading-to-3-0
首先检查是否存在以下问题:
- 启动 ietd(/etc/init.d/iscsitarget start)
- 执行 ietd -d 8 -f -> 预期结果:“1387214741.122258:内核模块版本不匹配!”
- 停止 ietd /etc/init.d/iscsitarget stop
要使用当前内核重建模块:
- 安装内核头:apt-get install pve-headers-$(uname -r)
- 安装 iscsitarget 的 DKMS:apt-get install iscsitarget-dkms
将以下行添加到文件“/var/lib/dkms/iscsitarget/1.4.20.2/source/dkms.conf”
PATCH[15]="兼容-2.6.38.补丁"
PATCH_MATCH[15]="2.6.(9|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38)"
重建模块:dkms autoinstall
- 启动 ietd(/etc/init.d/iscsitarget start)