Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: iSCSI initiator problems



On Tue, Mar 10, 2009 at 03:14:14PM +0200, Martti Kuparinen wrote:
> I have a NetBSD/amd64 5.0 host running Xen 3.3.1 dom0 and I'd like to 
> connect to my iSCSI target (Debian 5.0 with IET) in order to start my 
> domUs. I'd like to make all disks available as /dev/iscsi/virtualhostNN.
> 
> I've installed pkgsrc/devel/netbsd-iscsi-initiator but I can't figure out 
> how to use it correctly. Can anyone give a working example of his setup?
> 
> In CentOS 5.2 (with some udev magic), I simply do
> 
> # iscsiadm -m discovery -t sendtargets -p 172.16.17.1
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost01
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost02
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost03
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost04
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost05
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost06
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost07
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost08
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost09
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost10
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost11
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost12
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost13
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost14
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost15
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost16
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost17
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost18
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost19
> 172.16.17.1:3260,1 iqn.2001-04.com.mydomain:virtualhost20
> 
> # /etc/init.d/iscsi restart
> 
> # ls /dev/iscsi/virtualhost*
> /dev/iscsi/virtualhost01  /dev/iscsi/virtualhost08  /dev/iscsi/virtualhost15
> /dev/iscsi/virtualhost02  /dev/iscsi/virtualhost09  /dev/iscsi/virtualhost16
> /dev/iscsi/virtualhost03  /dev/iscsi/virtualhost10  /dev/iscsi/virtualhost17
> /dev/iscsi/virtualhost04  /dev/iscsi/virtualhost11  /dev/iscsi/virtualhost18
> /dev/iscsi/virtualhost05  /dev/iscsi/virtualhost12  /dev/iscsi/virtualhost19
> /dev/iscsi/virtualhost06  /dev/iscsi/virtualhost13  /dev/iscsi/virtualhost20
> /dev/iscsi/virtualhost07  /dev/iscsi/virtualhost14
> 
> # parted /dev/iscsi/virtualhost01 print
> 
> Model: IET VIRTUAL-DISK (scsi)
> Disk /dev/sds: 4295MB
> Sector size (logical/physical): 512B/512B
> Partition Table: msdos

The NetBSD iSCSI target isn't as polished as that - I have also only
tested the initiator with the NetBSD target.  However, this is a
transcript of a NetBSD initiator session:

Script started on Tue Mar 10 15:00:49 2009
[15:00:49] agc@vm1 ...examples/refuse/iscsi-initiator 1 > l /mnt
total 8
drwxr-xr-x   2 root  wheel   512 Jul 19  2008 .
drwxr-xr-x  23 root  wheel  1024 Feb 27 08:41 ..
[15:00:58] agc@vm1 ...examples/refuse/iscsi-initiator 2 > df
Filesystem  512-blocks       Used      Avail %Cap Mounted on
/dev/wd0a      16515036   14089532    1599756  89% /
kernfs                2          2          0 100% /kern
ptyfs                 2          2          0 100% /dev/pts
[15:01:03] agc@vm1 ...examples/refuse/iscsi-initiator 3 > sudo 
/etc/rc.d/iscsi_target start
Password:
Starting iscsi_target.
Reading configuration from `/etc/iscsi/targets'
target0:rw:0.0.0.0/0
        extent0:/tmp/iscsi-target0:0:104857600
DISK: 1 logical unit (204800 blocks, 512 bytes/block), type iscsi fs
DISK: LUN 0: 100 MB disk storage for "target0"
TARGET: TargetName is iqn.1994-04.org.netbsd.iscsi-target
[15:02:42] agc@vm1 ...examples/refuse/iscsi-initiator 5 > sudo ./iscsifs -u agc 
-h 127.0.0.1 /mnt
Password:
iscsifs: puffs_mount: cannot open /dev/puffs
iscsifs: puffs_mount: directory "/mnt": Device not configured
[15:02:53] agc@vm1 ...examples/refuse/iscsi-initiator 6 > sudo modload puffs
Password:
[15:03:09] agc@vm1 ...examples/refuse/iscsi-initiator 7 > sudo ./iscsifs -u agc 
-h 127.0.0.1 /mnt
Password:

^Z
Suspended
[15:03:26] agc@vm1 ...examples/refuse/iscsi-initiator 8 > bg
[1]    su root -c ./iscsifs -u agc -h 127.0.0.1 /mnt &
[15:03:27] agc@vm1 ...examples/refuse/iscsi-initiator 9 > df
Filesystem  512-blocks       Used      Avail %Cap Mounted on
/dev/wd0a      16515036   14089544    1599744  89% /
kernfs                2          2          0 100% /kern
ptyfs                 2          2          0 100% /dev/pts
/dev/puffs            0          0          0 100% /mnt
[15:03:30] agc@vm1 ...examples/refuse/iscsi-initiator 10 > l /mnt
total 132
drwxr-xr-x   2 root  wheel     0 Jan  1  1970 .
drwxr-xr-x  23 root  wheel  1024 Feb 27 08:41 ..
drwxr-xr-x   2 agc   agc     512 Mar 10 15:00 127.0.0.1
[15:03:33] agc@vm1 ...examples/refuse/iscsi-initiator 11 > l /mnt
total 132
drwxr-xr-x   2 root  wheel     0 Jan  1  1970 .
drwxr-xr-x  23 root  wheel  1024 Feb 27 08:41 ..
drwxr-xr-x   2 agc   agc     512 Mar 10 15:00 127.0.0.1

/mnt/127.0.0.1:
total 256
drwxr-xr-x  2 agc   agc    512 Mar 10 15:00 .
drwxr-xr-x  2 root  wheel    0 Jan  1  1970 ..
drwxr-xr-x  2 agc   agc    512 Mar 10 15:00 target0

/mnt/127.0.0.1/target0:
total 1152
drwxr-xr-x  2 agc  agc        512 Mar 10 15:00 .
drwxr-xr-x  2 agc  agc        512 Mar 10 15:00 ..
lrw-r--r--  1 agc  agc          9 Mar 10 15:00 hostname -> 127.0.0.1
lrw-r--r--  1 agc  agc          9 Mar 10 15:00 ip -> 127.0.0.1
lrw-r--r--  1 agc  agc         16 Mar 10 15:00 product -> NetBSD iSCSI    
-rw-r--r--  1 agc  agc  104857600 Mar 10 15:00 storage
lrw-r--r--  1 agc  agc         43 Mar 10 15:00 targetname -> 
iqn.1994-04.org.netbsd.iscsi-target:target0
lrw-r--r--  1 agc  agc          8 Mar 10 15:00 vendor -> NetBSD  
lrw-r--r--  1 agc  agc          4 Mar 10 15:00 version -> 0   
[15:03:42] agc@vm1 ...examples/refuse/iscsi-initiator 12 > uname -a
NetBSD vm1 5.99.7 NetBSD 5.99.7 (GENERIC) #36: Sat Jan 24 18:07:03 PST 2009  
agc@somewhere:/home/agc/build/obj/i386/home/agc/NetBSD/src/sys/arch/i386/compile/GENERIC
 i386
[15:03:42] agc@vm1 ...examples/refuse/iscsi-initiator 12 > exit
exit

Script done on Tue Mar 10 15:03:48 2009

That's a January -current. For 5.0, you will not need the modload step.

If you're wondering why sudo keeps asking for a password, it's not
because I'm paranoid (I am), but because I am using Christos's pam
substitute for su in /etc/pam.d/su uncommented, with myself in group
rootauth.

Regards,
Alistair


Home | Main Index | Thread Index | Old Index