Page 1 of 1

iSCSI Problem

Posted: 20. Jan 2011, 21:37
by twistedsolid
Hi .
I am having an issue with connecting iscsi storage. I have set up the Iscsi controller succesfully then use the following command
VBoxManage storageattach "virtual-rhel54" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium iscsi --server xx.xxx.xxx.xxx --target "iqn.1994-05.com.redhat:xxxxxxxxx"
iSCSI disk created. UUID: a0d64a2e-a6df-4846-88b8-cb1a6f4c95d7

when I go to start the OS I get the follwing error:
xx.xxx.xx.xx|iqn.1994-05.com.redhat:267xxxxxxxxxxxx
Type (format):Normal (iSCSI)
attached to:virtual-rhel54
----------------------------------------------------
could not open medium 'xx.xxx.xx.xx|iqn.1994-05.com.redhat:267xxxxxxxxxxxx'.
iSCSI;target address xx.xxx.xx.xx, target name iqn.1994-05.com.redhat:267xxxxxxxxxxxx, SCSI LUN 0
reports device type=12 (VERR_VD_ISCSI_INVALID_TYPE).
VD:error VERR_VD_ISCSI_INVALID_TYPE opening image file
xx.xxx.xx.xx|iqn.1994-05.com.redhat:267xxxxxxxxxxxx
(VERR_VD_ISCSI_INVALID_TYPE).

DETAILS: NS_ERROR_FAILURE ( 0x80004005)
Component: Medium
Interface: IMedium

Any help with the issue would be greatly appreciated.
Thank you
Dan.

Re: iSCSI Problem

Posted: 23. Feb 2011, 08:01
by KeithC777
Hi Dan,

I struggled with this same problem for most of today. I finally figured it out for myself. Maybe what I did can help you, even though it has been a month since your post.

First, I saw someone post online that you should only attach an iSCSI disk to either a VM's IDE controller or a SCSI controller. They said that a SATA controller always gave them problems. I'm not sure if this is true as I still had the problem after I created a SCSI controller in my VM and attached the disk to it. I can't recall where I saw this posted.

What really seemed to be causing the problem for me was not specifying the "--lun" option on the command line (even though it's listed as optional in the docs), or when I did specify it, I had the wrong value.

You see, I was trying to get my VM to connect to an iSCSI disk on my Thecus N5200PRO home NAS unit, and on the version of the NAS firmware I have you cannot specify the LUN number (nor does it display it). I found online that it does seem to specify the LUN numbers starting at zero and increments by 1 for each iSCSI target you create. So my problem was that I specified either no --lun option (I think that causes VBox to default to 0), or when I did specify it, I used "--lun 0" or "--lun 1". Turns out that since I was trying to connect to the third target displayed in the NAS GUI, I needed to use "--lun 2" (I figured they would all be LUN 0 since they all had unique target names).

BTW, if your targets happen to be on a Thecus NAS too, I found you can directly view the LUN numbers inside the file at /raid0/sys/ietd.conf on the Thecus NAS internal filesystem. This requires that you have installed the SSH module so you can ssh into the NAS. Also the zero in "raid0" might have to be replaced with another number if your NAS unit has multiple RAIDs setup.

So where ever your targets are hosted, you need to discover the LUN number of your target and specify it on the command line using the "--lun" option.

Once I got it working, I just left the disk attached to the SCSI controller, so I'm not sure if the SATA controller would work.

Hope that helps.

-Keith