.\" $NetBSD: iscsi-initiator.8,v 1.8 2011/02/22 17:15:55 sborrill Exp $
.\"
.\" Copyright © 2007 Alistair Crooks. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. The name of the author may not be used to endorse or promote
.\" products derived from this software without specific prior written
.\" permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd February 22, 2011
.Dt ISCSI-INITIATOR 8
.Os
.Sh NAME
.Nm iscsi-initiator
.Nd refuse-based iSCSI initiator
.Sh SYNOPSIS
.Nm
.Op Fl 46bcDfVv
.Op Fl a Ar authentication-type
.Op Fl d Ar digest-type
.Op Fl h Ar target-hostname
.Op Fl p Ar target-port-number
.Op Fl t Ar target-number
.Op Fl u Ar username
.Ar mount_point
.Sh DESCRIPTION
The
.Nm
utility can be used to access an iSCSI target, such as
.Xr iscsi-target 8 ,
to access block storage which has been exported.
Information pertaining to the target is displayed underneath
the mount point, along with the device corresponding
to the storage which the target exports.
.Pp
The various arguments are as follows:
.Bl -tag -width Ds
.It Fl 4
Use an IPv4 connection to the target.
.It Fl 6
Use an IPv6 connection to the target.
.It Fl a Ar authentication-type
Use the specified authentication type when communicating with the target.
The possible values are chap, kerberos, srp or none.
The default value is none.
.It Fl b
Show the storage as a block device.
.It Fl c
Show the storage as a character device.
.It Fl d Ar digest-type
Use the specified digest type when communicating with the target.
The possible values are header, data, both, all or none.
The default value is none.
.It Fl D
List the LUNs on the specified target and exit (i.e. do discovery only)
.It Fl f
Show the storage as a regular file.
.It Fl h Ar hostname
Connect to the iSCSI target running on the host specified as the argument.
.It Fl p Ar port-number
Connect to the iSCSI target running on the port specified as the argument.
The default value is 3260.
.It Fl t Ar target
Connect to the number of the iSCSI target running as the argument.
.It Fl u Ar username
Use the specified user's credentials when logging in to the iSCSI target.
There is no default.
.It Fl V
Print out the version number and then exit.
.It Fl v
Be verbose in operation.
.El
.Pp
The
.Xr refuse 3
library is used to provide the file system features.
.Pp
The mandatory parameter is the local mount point.
.Pp
This iSCSI initiator presents a view of the targets underneath the
mount point.
Firstly, it creates a directory tree with the hostname of the target,
and, in that directory, a virtual directory is created for each
target name exported by the iSCSI target program.
Within that virtual target directory, symbolic links exist for
the hostname (for convenience),
a textual representation of the IP address,
the iSCSI target product name,
the iSCSI target IQN,
the iSCSI target vendor and version number.
One other directory entry is presented in the virtual target
directory, relating to the storage presented by the iSCSI target.
This can be in the form of a regular file, which is also the
default, a block device or a character device.
.Pp
Please note that the
.Nm
utility needs the
.Dq puffs
kernel module loaded via
.Xr modload 8
to operate.
.Sh EXAMPLES
.Bd -literal
# ./iscsi-initiator -u agc -h iscsi-target0.alistaircrooks.co.uk /mnt
# ls -al /mnt/target0
total 576
drwxr-xr-x 2 agc agc 512 May 11 22:24 .
drwxr-xr-x 2 agc agc 512 May 11 22:24 ..
lrw-r--r-- 1 agc agc 39 May 11 22:24 hostname -\*[Gt] iscsi-target0.alistaircrooks.co.uk
lrw-r--r-- 1 agc agc 14 May 11 22:24 ip -\*[Gt] 172.16.135.130
lrw-r--r-- 1 agc agc 16 May 11 22:24 product -\*[Gt] NetBSD iSCSI
-rw-r--r-- 1 agc agc 104857600 May 11 22:24 storage
lrw-r--r-- 1 agc agc 43 May 11 22:24 targetname -\*[Gt] iqn.1994-04.org.netbsd.iscsi-target:target0
lrw-r--r-- 1 agc agc 8 May 11 22:24 vendor -\*[Gt] NetBSD
lrw-r--r-- 1 agc agc 4 May 11 22:24 version -\*[Gt] 0
#
.Ed
.Sh SEE ALSO
.Xr puffs 3 ,
.Xr refuse 3 ,
.Xr iscsi-target 8
.Sh HISTORY
The
.Nm
utility first appeared in
.Nx 6.0 .
An earlier version called iscsifs was available in
.Nx 5.0
in source format only.
.Sh AUTHORS
The
.Nm
utility was written by
.An Alistair Crooks
.Aq agc@NetBSD.org .
.Sh BUGS
.Nm
currently only supports a CHAP challenge length of 16 octets.
Other initiators support up to 1024 and thus it is expected that most targets
will also support such lengths.
This means that CHAP compatibility with other targets apart from
.Xr iscsi-target 8
is likely to be poor.
To workaround this, please use authentication type none by not specifying a
username with the
.Fl u
option.