Getting Familiar with iSCSI Part 2: Configuring the Microsoft iSCSI Initiator

- select the contributor at the end of the page -
In Getting familiar with iSCSI Part 1, I outlined the steps to install the free Microsoft iSCSI Target and how to mount the vhd (virtual hard disk) locally on the iSCSI Target (storage provider). In this blog, I will configure the iSCSI initiator (the client) as well as configure the iSCSI target to test snapshots. Ensure you have a Microsoft iSCSI target set up before working through this example.

Configuring the Microsoft iSCSI Initiator on Windows 7

On a separate machine from the iSCSI Target, configure the iSCSI Initiator using the instructions below. Windows 7 and Window 2008 and higher have a built in iSCSI initiator, but the initiator is also available for older versions of Windows. Our example will use Windows 7.

1) Launch Start/Control Panel/Administrative Tools/iSCSI Initiator.

configuring iscsi initiator 1

2) Select Yes to start the Microsoft iSCSI service.

configuring iscsi initiator 2

3) Re-launch iSCSI initiator (Control Panel/Administrative Tools/iSCSI Initiator). Note the IQN address on the Configuration tab for use in the next set of steps.

configuring iscsi initiator 3

The IQN (iSCSI qualified name) includes machine name and domain name, among other elements. Here's the breakdown of the initiator name (IQN) elements: May 1991 is when Microsoft.com was registered, pdcwin0702 is the iSCSI initiator machine name, and cagola1.local is the Active directory domain name.

Configuring the iSCSI Target to allow access to the storage data

1) On the iSCSI Target Machine (Windows 2008 R2), launch the iSCSI Target Software. Right click on iSCSI Target and click Create iSCSI Target.

configuring iscsi initiator 4

2) Click Next.

configuring iscsi initiator 5

3) Enter iSCSI target name and Description. I have used machine name as the target name.

configuring iscsi initiator 6

4) Enter the IQN from the iSCSI Initiator (client), noted earlier, from the Windows 7 machine.

configuring iscsi initiator 7

5) Click Finish.

configuring iscsi initiator 8

6) Right click on the newly created iSCSI Target, and then select “Add Existing Virtual Disk to iSCSI Target.”

configuring iscsi initiator 9

7) Select the desired Virtual Disk, and click OK.

configuring iscsi initiator 10

Now we have allowed access to the disk on the iSCSI target by the iSCSI initiator (client).

Connect the iSCSI initiator to the iSCSI target disk.

On the iSCSI Initiator (client), Windows 7 in our case, Open the iSCSI Initiator again.

1) Type the IP Address of the iSCSI Target (Windows 2008 R2), and click “Quick Connect”, then OK.

configuring iscsi initiator 11

2) Click Done.

configuring iscsi initiator 12

Since we already formatted the partition in Part 1 of the ISCSI blog, we simply need to check Windows Explorer for the new drive.

configuring iscsi initiator 13

Testing the Snapshot Feature of the iSCSI Target

In this example, we'll simulate a typical case where snapshots would allow file recovery when a file is deleted.

1. On the iSCSI initiator (Windows 7 machine), create a few documents in Notepad and save them to the iSCSI Target disk (e.g. E: drive). I chose the name testfile1.txt and testfile2.txt.

Your mounted 2 gig drive should look similar to this:

configuring iscsi initiator 14

2. Now on the iSCSI Target (Windows 2008 R2 machine), configure a snapshot, click on Devices, right click on the Virtual Disk 0, and select Create Snapshot:

configuring iscsi initiator 15

3. Select ok to confirm the snapshot creation:

configuring iscsi initiator 16

4. Now return to the iSCSI initiator (Windows 7) and delete the testfile1.txt file. The screen should now appear as follows:

configuring iscsi initiator 17

A couple of options exist for recovering the testfile1.txt. We could mount the snapshot locally on the iSCSI target via the snapshot feature and recover the file, or simply roll back to the snapshot. Since we've already worked on mounting volumes in Part 1, we'll roll back to the snapshot in this example.

5. On the iSCSI Target (Windows 2008 R2 machine) right-click on Virtual Disk 0, and select “Roll Back to Snapshot.”

configuring iscsi initiator 18

6. Select Yes.

configuring iscsi initiator 19

7. The rollback fails because we still have the iSCSI disk mounted on the iSCSI initiator, the Windows 7 client pc. This is a key piece of information- in general, iSCSI partitions can only be connected to one iSCSI initiator.

configuring iscsi initiator 20

8. On the iSCSI initiator (Windows 7 pc), click the iSCSI connection name, and then select Disconnect.

configuring iscsi initiator 21

9. Select OK to confirm disconnection.

configuring iscsi initiator 22

10. Now return to the iSCSI target machine (Windows 2008 r2), and initiate another rollback by right clicking on the virtual disk and selecting “Roll Back to Snapshot”. Check the status of the rollback.

configuring iscsi initiator 23

configuring iscsi initiator 24

11. Return to the iSCSI initiator(Windows 7 pc), and select connect:

configuring iscsi initiator 25

12. Double check that all files are present:

configuring iscsi initiator 26

The files have been recovered.

Being able to mount storage on a server or desktop can be critical at some points. For example, I've encountered difficult issues with SQL server backups. Typically the built-in Microsoft SQL server backups will only save to a locally mounted drive. In one case, I had a test system that ran out of disk space on the SQL partition. To allow backups to continue, I mounted an ISCSI partition, and easily was able to create a new local disk for backups.

Conclusion

iSCSI is used for many purposes and using a free iSCSI tool such as Microsoft's iSCSI Target is a great way to become familiar with the usage of ISCSI. This will assist you in laying the foundation of knowledge needed for working with storage area networks or NAS devices.

Get our content first. In your inbox.

Loading form...

If this message remains, it may be due to cookies being disabled or to an ad blocker.

Contributor

Tony Bieda

Tony Bieda has over 10 years of experience as a systems engineer. He's an MCSE and MCDBA. His areas of focus are network infrastructure and Windows system architecture.