Назад | Перейти на главную страницу

Базовая настройка цели iSCSI на Proxmox VE (Debian 7) не работает

Я создал раздел 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

У меня такая же проблема. Эта вики-ветка исправила проблему:

http://forum.proxmox.com/threads/14029-iSCSI-target-stopped-working-when-upgrading-to-3-0

Прежде всего, проверьте, существует ли следующая проблема:

  1. Запустить ietd (/etc/init.d/iscsitarget start)
  2. Выполните ietd -d 8 -f -> Ожидаемый результат: «1387214741.122258: несоответствие версии модуля ядра!»
  3. Остановить ietd /etc/init.d/iscsitarget stop

Чтобы пересобрать модуль с текущим ядром:

  1. Установите заголовки ядра: apt-get install pve-headers - $ (uname -r)
  2. Установите DKMS iscsitarget: apt-get install iscsitarget-dkms
  3. Добавьте следующие строки в файл '/var/lib/dkms/iscsitarget/1.4.20.2/source/dkms.conf'

    PATCH [15] = "compat-2.6.38.patch"

    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) »

  4. Восстановить модули: автоматическая установка dkms

  5. Запустите ietd (/etc/init.d/iscsitarget start)

Это не должно было быть грубым ответом на мои собственные вопросы, но на самом деле было моим «решением»:

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