Cisco iSCSI Initiator Command Reference

As mentioned earlier, the Linux-iSCSI Initiator implementation is simply the Open Source version of the Cisco closed source driver avilable for several platforms. Here is a quick overview of it's diffrent tools.

Cisco iSCSI Initiator Tools

iscsi-iname

A iSCSI initiator address generator. Using /dev/random and the system clock it creates a (hopefully) unique address that can be used for initiator setup. This tool is used for generating the initial iSCSI initiator address stored in /etc/initiatorname.iscsi

[root@nexus /]# iscsi-iname 
iqn.1987-05.com.cisco:01.8494d06dc35d
[root@nexus /]# 
	

Warning

Some iSCSI devices implement access control based on the initiators iSCSI address. Do not use use the address supplied by iscsi-iname. Your true initator address is stored in the file /etc/initiatorname.iscsi. The address in this file will be returned to the portal as your valid address, and therefore should always be used. The address in that file can in fact be changed but it must be unique. Using the default is recommended.

iscsi-ls

Display details about avalible targets. With no arguments you can view all the avilible targets. Using -l you can view LUN information for each target. Using -c you can view the target configuration information (timeouts, burst lengths, etc). Both -b and -t provide ways to query a specific target either by the local busId or by the target ID (address) itself.

[root@nexus /]# iscsi-ls 
***********************************************************
        Cisco iSCSI Driver Version ... 3.4.2 (16-Feb-2004 )
***********************************************************
TARGET NAME             : iqn.1997-06.com.homestead:stora..
TARGET ALIAS            : 
HOST NO                 : 1 
BUS NO                  : 0 
TARGET ID               : 0 
TARGET ADDRESS          : 10.10.1.100:3260
SESSION STATUS          : ESTABLISHED AT Tue Apr 13 12:25:..
NO. OF PORTALS          : 1 
PORTAL ADDRESS 1        : 10.10.1.100:3260,1
SESSION ID              : ISID 00023d000001 TSID 100
************************************************************
        
iscsi-device

Display tab delimited output detailing information reguarding an iSCSI block device, including target address, target IP and port, LUN number, etc. This is just a diffrent way of getting the same info you can get form iscsi-ls.

[root@nexus /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1             4.8G  4.3G  285M  94% /
/dev/hda5              13G   11G  2.0G  85% /home
/dev/sdj1              68G  391M   67G   1% /iscsi_raid
[root@nexus /]# iscsi-device /dev/sdj 
/dev/sdj: 0   2   0        10.10.1.100   3260  
	iqn.1997-06.com.homestead:storage.raid.stripe0
        
iscsi-mountall

The iSCSI equivelent to mountall. It attempts to mount all the file systems listed in the /etc/fstab.iscsi file, which uses the same syntax as the standard system fstab.

[root@nexus /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1             4.8G  4.3G  285M  94% /
/dev/hda5              13G   11G  2.0G  85% /home
[root@nexus /]# cat /etc/fstab.iscsi 
# /etc/fstab.iscsi file for filesystems built on iscsi devices.
#iSCSI LUN      Mount Point     FS      Options  Dump Pass
#---------      -----------     ---     -------  ---- ----

/dev/sdj1       /iscsi_raid     jfs     defaults    0    0
[root@nexus /]# iscsi-mountall 
fsck.jfs version 1.1.0, 20-Nov-2002
The current device is:  /dev/sdj1
Block size in bytes:  4096
File system size in blocks:  17782524
Phase 0 - Replay Journal Log
File system is clean.

[root@nexus /]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1             4.8G  4.3G  285M  94% /
/dev/hda5              13G   11G  2.0G  85% /home
/dev/sdj1              68G  391M   67G   1% /iscsi_raid
[root@nexus /]# 
	
iscsi-umountall

The converse of iscsi-mountall. It unmounts all filesystems specified in /etc/fstab.iscsi.