Notes on iSCSI and Server Core 2012

For the Initiator (client)


  1. Be sure to enable the enable the MSiSCSI service and set its startup type to Automatic.

  2. Ensure the iSCSI initiator outgoing & incoming rules are allowed on the firewall.

Connecting to a Target

To connect to a target you have to connect to a target portal first. The portal lets you enumerate the targets available.

After connecting, list the targets thus:

Do this for each portal you are aware of:

Note that Get-IscsiTarget now lists targets from all the portals.

To connect to a specific target, use the Connect-IscsiTarget cmdlet:

Viewing the disks

To view the disks available, use the Get-Disk cmdlet.

Numbers 2 & 3 are the iSCSI disks.

As far as the OS is concerned these are regular disks. To use them: 1) Change their status to online, 2) Initialize the disk, and 3) Partition & Format.

If you have many disks (physical or via iSCSI) you can also use the Get-IscsiConnection and Get-IsciSession to select just the iSCSI connections you want, and filter these to the Get-Disk cmdlet.

Making a session persistent across reboots

By default iSCSI connections are not persistent across reboots (note the IsPersistent : False above). To make a connection persistent there area two options:

  1. When connecting to the iSCSI target the first time use the -IsPersistent switch.

  2. If you want to make an existing session persistent, pipe it to the Register-IcsiSession cmdlet.

To make a session non-persistent, pipe it to the Unregister-IscsiSession cmdlet.

Disconnecting a Target

If you would like to disconnect a session use the Disconnect-IscsiTarget cmdlet.

For the Target (server)

  1. Create a Target.

    When creating the target it is very important to specify the initiator IDs. The cmdlet doesn’t prompt for these if you don’t mention (unlike the UI which doesn’t go ahead unless initiator IDs are specified). If the initiator IDs are missing no one can see this target.

    Initiator IDs can be specified via IQNs, IP addresses, IPv6 addresses, DNS name, and MAC addresses. Notice the ‘IPN:xxx’ bit above? Replace IQN with IPAddress, IPv6Address, DNSName, and MACAddress if you are specifying initiator IDs using these, followed by the address or name. For instance:

    If there’s only one initiator ID it can be specified as it is. If there multiple, separate them with commas. There’s no need to put them inside @(…) as above – that’s just to make it explicit to the reader that the input is an array. Separating by commas will have the same effect irrespective of the @(…) notation.

    It’s also worth pointing out that if multiple initiators are allowed to access a target, they will all be able to read/write to the target, but expect corruption. There are exceptions of course.

  2. Create an iSCSI virtual disk which will back the LUN presented by the target.

  3. Create multiple virtual disks if needed.
  4. Map these virtual disks to the target.

And that’s it. Initiators can now connect to the target. In the example above, since the target has two LUNs, initiators will see two disks after connecting.