<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>FCI Archives - DBAduck</title>
	<atom:link href="https://www.dbaduck.com/tag/fci/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbaduck.com/tag/fci/</link>
	<description>DBA</description>
	<lastBuildDate>Wed, 18 May 2022 18:53:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.dbaduck.com/wp-content/uploads/2013/12/cropped-dbaducklogo-2-32x32.png</url>
	<title>FCI Archives - DBAduck</title>
	<link>https://www.dbaduck.com/tag/fci/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Connecting iSCSI LUNs with PowerShell</title>
		<link>https://www.dbaduck.com/connecting-iscsi-luns-with-powershell/</link>
					<comments>https://www.dbaduck.com/connecting-iscsi-luns-with-powershell/#respond</comments>
		
		<dc:creator><![CDATA[dbaduck]]></dc:creator>
		<pubDate>Mon, 09 Sep 2019 01:46:01 +0000</pubDate>
				<category><![CDATA[iSCSI]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Clustering]]></category>
		<category><![CDATA[FCI]]></category>
		<guid isPermaLink="false">https://dbaduck.com/?p=580</guid>

					<description><![CDATA[<p>When clustering SQL on Windows Server Core, I had the need to configure the ISCSI LUNs to the server without UI.&#160; I know that there is a UI component called iscsicpl.exe that you can run and it will pop up the simple Windows UI to allow you to click through all the configuration, but I [&#8230;]</p>
<p>The post <a href="https://www.dbaduck.com/connecting-iscsi-luns-with-powershell/">Connecting iSCSI LUNs with PowerShell</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>When clustering SQL on Windows Server Core, I had the need to configure the ISCSI LUNs to the server without UI.&nbsp; I know that there is a UI component called <em><span style="color: #ff0000;"><strong>iscsicpl.exe</strong></span></em> that you can run and it will pop up the simple Windows UI to allow you to click through all the configuration, but I wanted to go purist on this one and learn the nuances of configuration via PowerShell the whole way through.</p>



<p>First you would have a SAN LUN configured for iSCSI which would have a IQN like <strong><em><span style="color: #ff0000;">iqn.1991-05.com.microsoft:winsan-winsql1-target.</span></em></strong> This is a unique identifier for the iSCSI resource and this is what you would connect to for the drive.&nbsp; To make this connection you would use the iSCSI module that has the commands you will see.&nbsp; Below is the example of the connection.</p>



<pre class="lang:PowerShell">
# On Client Computer 
$TargetPortal1 = "10.1.1.1" 
$TargetPortal2 = "10.1.2.1" 
$ISCSIIP1 = "10.1.1.2" 
$ISCSIIP2 = "10.1.2.2" 
New-IscsiTargetPortal -TargetPortalAddress $TargetPortal1 -InitiatorPortalAddress $ISCSIIP1  
New-IscsiTargetPortal -TargetPortalAddress $TargetPortal2 -InitiatorPortalAddress $ISCSIIP2 
</pre>



<figure class="wp-block-image"><a href="https://dbaduck.com/wp-content/uploads/2019/09/ClientISCSI_1.png"><img decoding="async" src="https://dbaduck.com/wp-content/uploads/2019/09/ClientISCSI_1_thumb.png" alt="ClientISCSI_1"/></a></figure>



<p><strong>Figure 1.1 – The same as New Discovery Portal in iscsicpl</strong></p>



<p>&nbsp;</p>



<pre class="lang:powershell">
Start-Sleep -seconds 2

Connect-IscsiTarget -NodeAddress "iqn.1991-05.com.microsoft:winsan-winsql1-target" <code>
	-IsPersistent $true -IsMultipathEnabled $true -TargetPortalAddress $TargetPortal1 </code>
	-InitiatorPortalAddress $ISCSIIP1

Connect-IscsiTarget -NodeAddress "iqn.1991-05.com.microsoft:winsan-winsql1-target" <code>
	-IsPersistent $true -IsMultipathEnabled $true -TargetPortalAddress $TargetPortal2 </code>
	-InitiatorPortalAddress $ISCSIIP2
</pre>



<figure class="wp-block-image"><a href="https://dbaduck.com/wp-content/uploads/2019/09/ClientISCSI_2.png"><img decoding="async" src="https://dbaduck.com/wp-content/uploads/2019/09/ClientISCSI_2_thumb.png" alt="ClientISCSI_2"/></a></figure>



<p>&nbsp;</p>



<p><strong>Figure 1.2 – Connecting with MultiPath IO using 2 different Targets and Initiators</strong></p>



<p>Now you have a drive attached, at least in iSCSI.&nbsp; This drive will be a raw drive and using <strong><em>Get-Disk</em></strong>&nbsp; will show them. This cmdlet is in the <strong><em>Storage</em></strong>&nbsp; module in PowerShell.</p>



<figure class="wp-block-image"><a href="https://dbaduck.com/wp-content/uploads/2019/09/ClientISCSI_Get-Disk.png"><img decoding="async" src="https://dbaduck.com/wp-content/uploads/2019/09/ClientISCSI_Get-Disk_thumb.png" alt="ClientISCSI_Get-Disk"/></a></figure>



<p><strong>Figure 1.3 – Get-Disk in action. Showing the newly attached drive</strong></p>



<p>The next task is to online and configure the new drive so that you can use it. You need to initialize the disk, then create a partition of type GPT and finally format the volume with 64KB blocks for use with SQL Server.</p>



<p><pre class="lang:powershell">
Initialize-Disk -Number 1 -PartitionStyle GPT # Data

New-Partition -DiskNumber 1 -UseMaximumSize -DriveLetter E 
</pre></p>



<figure class="wp-block-image"><a href="https://dbaduck.com/wp-content/uploads/2019/09/ClientISCSI_Initialize-Disk_New-Paritition.png"><img decoding="async" src="https://dbaduck.com/wp-content/uploads/2019/09/ClientISCSI_Initialize-Disk_New-Paritition_thumb.png" alt="ClientISCSI_Initialize-Disk_New-Paritition"/></a></figure>



<p><strong>Figure 1.4 – Initialize-Disk and New-Partition to make the drive accessible</strong></p>



<p><pre class="lang:powershell">
Get-Volume -DriveLetter E | 
         Format-Volume -FileSystemLabel DATA -AllocationUnitSize (64KB) -FileSystem NTFS `
                -ShortFileNameSupport $false
</pre></p>



<figure class="wp-block-image"><a href="https://dbaduck.com/wp-content/uploads/2019/09/ClientISCSI_Get-Volume_Format-Volume.png"><img decoding="async" src="https://dbaduck.com/wp-content/uploads/2019/09/ClientISCSI_Get-Volume_Format-Volume_thumb.png" alt="ClientISCSI_Get-Volume_Format-Volume"/></a></figure>



<p><strong>Figure 1.5 – Get-Volume and Format-Volume to finish setting up the drive</strong></p>



<p>This concludes this part of the creation of a drive from the iSCSI side of the house.&nbsp; The entire piece of code is available here.</p>



<p>Happy PowerShelling. Onward in the quest to become a SQL PowerShell DBA.</p>
<p>The post <a href="https://www.dbaduck.com/connecting-iscsi-luns-with-powershell/">Connecting iSCSI LUNs with PowerShell</a> appeared first on <a href="https://www.dbaduck.com">DBAduck</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbaduck.com/connecting-iscsi-luns-with-powershell/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
