Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have created a Linux LVM partition on my disk and want to share it over network via iSCSI. However, the target is unreachable with iscsiadm (from both local and remote). The setup is shown below.

Does anybody know the reason that I cannot connect/discover my iSCSI target? (Please let me know, if you need further information.)

In my setup, node01 is running on Proxmox VE 3.1 (Debian 7) with DNS name node01.domain.name and static IP address 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

Creation of LVM volume group:

$ 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 target setup:

$ 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 test:

$ 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
share|improve this question
    
I know this is not the problem, but i'm curious, why you created a partion for create a vg, intend of create your vg directly on your device? –  c4f4t0r Dec 3 '13 at 15:29
    
As far as I know, you can only add LVM partitions to a LVM volume group but not complete (raw) devices. Hence, I created one LVM partition that occupies the full disk and added it to the volume group. Further, after configuring the iSCSI target successfully (see in my own answer), the volume group is also visible and usable at the initiator side. –  sema Dec 4 '13 at 17:28
add comment

2 Answers

up vote 0 down vote accepted

This is not meant to be a rude answer to my own questions, but was really my 'solution':

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

On the initiator side, do this:

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

For more information, see here: http://www.cyberciti.biz/tips/howto-setup-linux-iscsi-target-sanwith-tgt.html

To make this permanent, use this on the target side:

tgtadm --dump > /etc/tgt/targets.conf

# Add this to /etc/rc.local
/usr/sbin/tgtd
tgt-admin --execute

To make a clean 'logoff' add this to a script for shutdown on the initiator side

# 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
share|improve this answer
add comment

i had the same problem. This wiki thread fixed the problem:

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

First of all, check if the following problem exists:

  1. Start ietd (/etc/init.d/iscsitarget start)
  2. Execute ietd -d 8 -f -> Expected result: "1387214741.122258: kernel module version mismatch!"
  3. Stop ietd /etc/init.d/iscsitarget stop

To rebuild the module with current kernel:

  1. Install kernel headers: apt-get install pve-headers-$(uname -r)
  2. Install DKMS of iscsitarget: apt-get install iscsitarget-dkms
  3. Add the following lines to the file '/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. Rebuild modules: dkms autoinstall

  5. Start ietd (/etc/init.d/iscsitarget start)
share|improve this answer
    
Please don't just give links, as external websites may disapear. Instead rephrase relevant parts according to the question. –  Eric DANNIELOU Dec 3 '13 at 15:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.