Configuración por linea de comandos iScsiCli

En este articulo vamos a ver como configurar en un Windows Server 2008 Core o en un Hyper-V Server que solo te admiten la linea de comandos la posibilidad de conectarle discos iscsi.

Configuramos el servicio iscsi automatico

Users juan> sc config start msiscsi = auto

[SC] ChangeServiceConfig SUCCESS

Iniciamos el servicio

Users juan> net start msiscsi

The Microsoft iSCSI Initiator Service service is starting.
The Microsoft iSCSI Initiator Service service was started successfully.

Añadimos el destino de iscsi, es decir apuntamos a nuestro servidor de discos iscsi, y listamos los discos asociados

Users juan> iscsicli QAddTargetPortal 192.168.1.31

Microsoft iSCSI Initiator Version 6.0 Build 6000
The operation completed successfully.

Users juan> iscsicli ListTargets

Microsoft iSCSI Initiator Version 6.0 Build 6000

Targets List:
quorum
data
The operation completed successfully.

A continuación nos conectamos a uno de los discos

Users juan> iscsicli qlogintarget data

Microsoft iSCSI Initiator Version 6.0 Build 6000
Session Id is 0xfffffa800626e018-0x4000013700000006
Connection Id is 0xfffffa800626e018-0x5
The operation completed successfully.

Para asegurarnos que la conexion es correcta

Users juan> iscsicli reporttargetmappings

Microsoft iSCSI Initiator Version 6.0 Build 6000

Total of 1 mappings returned
Session Id : fffffa800626e018-4000013700000006
Target Name : data
Initiator : RootISCSIPRT000_0
Initiator Scsi Device : \.Scsi4:
Initiator Bus : 0
Initiator Target Id : 0
Target Lun: 0x0 <–> OS Lun: 0x0

The operation completed successfully.

Para desconectarnos del disco

Users juan>iscsicli logouttarget fffffa800626e018-4000013700000006

Microsoft iSCSI Initiator Version 6.0 Build 6000

The operation completed successfully.

Para comprobarlo

Users juan> iscsicli reporttargetmappings

Microsoft iSCSI Initiator Version 6.0 Build 6000

No Mappings
The operation completed successfully.

Por defecto el qlogintarget se pierde con el reiniciar el equipo, para que sea persistente

Users juan> iscsicli PersistentLoginTarget data T * * * * * * * * * * * * * * * 0

Microsoft iSCSI Initiator Version 6.0 Build 6000

The operation completed successfully.

Para confirmarlo

Users juan> iscsicli listpersistenttargets

Microsoft iSCSI Initiator Version 6.0 Build 6000

Total of 1 peristent targets
Target Name : data
Address and Socket : 192.168.1.31 3260
Session Type : Data
Initiator Name : RootISCSIPRT000_0
Port Number :
++Security Flags : 0x0
++Version : 0
++Information Specified: 0x20
++Login Flags : 0x8
++Username :

The operation completed successfully.

Para borrar una conexion permanente, utilizamos los valores obtenidos anteriormente

Usersjuan>iscsicli removepersistenttarget RootISCSIPRT000_0
data * 192.168.1.31 3260

Microsoft iSCSI Initiator Version 6.0 Build 6000

The operation completed successfully.