Getting Familiar with iSCSI Part 2: Configuring the Microsoft iSCSI Initiator
- select the contributor at the end of the page -
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.
2) Select Yes to start the Microsoft iSCSI service.
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.
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.
2) Click Next.
3) Enter iSCSI target name and Description. I have used machine name as the target name.
4) Enter the IQN from the iSCSI Initiator (client), noted earlier, from the Windows 7 machine.
5) Click Finish.
6) Right click on the newly created iSCSI Target, and then select “Add Existing Virtual Disk to iSCSI Target.”
7) Select the desired Virtual Disk, and click OK.
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.
2) Click Done.
Since we already formatted the partition in Part 1 of the ISCSI blog, we simply need to check Windows Explorer for the new drive.
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:
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:
3. Select ok to confirm the snapshot creation:
4. Now return to the iSCSI initiator (Windows 7) and delete the testfile1.txt file. The screen should now appear as follows:
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.”
6. Select Yes.
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.
8. On the iSCSI initiator (Windows 7 pc), click the iSCSI connection name, and then select Disconnect.
9. Select OK to confirm disconnection.
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.
11. Return to the iSCSI initiator(Windows 7 pc), and select connect:
12. Double check that all files are present:
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.
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.