How to connect an ESXi host to an iSCSI storage target
Image 1 of 12
Configure shared storage for ESXi host
ntIn an earlier blog post, I showed how to install ESXi as a virtual machine for testing purposes. This is one of the fundamental steps to building a virtualization test lab to play with features of vSphere.
ntAnother fundamental step is configuring some sort of shared storage for an ESXi host. This can be done using software storage products such as StarWind, Openfiler, FreeNAS or Nexenta. Many of these are available in free installations as well. Of course this can connect to hardware SANs that present storage over iSCSI as well.
ntThis gallery will walk you through adding iSCSI storage in a lab capacity for vSphere.
ESXi with only local storage
ntThe first step is to have a virtual storage product configured with a LUN ready to go via iSCSI. Once that is ready, the ESXi host can be configured to add storage. This image shows an ESXi host only with local storage, designated as “datastore1.”
Using the vmkernel interface
ntOnce the LUN is ready, the ESXi host needs to be configured to communicate with the iSCSI target. In ESXi, this is done on the vmkernel interface. A vmkernel interface is installed by default, but for storage it should be separated as much as possible. In this image, an additional vmkernel interface is being added.
ntEven though this configuration is a lab environment, I’m still separating the storage traffic to new interfaces.
ntNote that the default gateway cannot be changed AND is on a separate subnet. This is by design, as that is the first vmkernel interface and is a visual reminder that the storage traffic is separated from the other vmkernel traffic on vmnic0.
ntOnce the additional vmkernel interface is ready, a simple ESXi configuration may look like what is shown in this image.
ntThis particular lab environment has four network interfaces available to the server, vmnic0 through vmnic3. The management traffic will exist on vSwitch0 (a default configuration) and the storage traffic will be configured to run on vSwitch0, a separate physical media than the management traffic.
Enable the iSCSI initiator on the ESXi host
ntWe now must enable the iSCSI initiator on the ESXi host. The iSCSI initiator is the software component that connects to the ESXi host to the storage processor running as an iSCSI target. The target owns the disk resource for ESXi and should be configured ahead of time. Individual LUNs for ESXi should be 2TB minus 512 bytes or smaller.
ntEnabling the iSCSI initiator is shown in this image by clicking each area in the orange boxes.
ntOnce the OK button is selected, the iSCSI qualified name (IQN) number is generated as shown in the yellow box.
Add the storage target to the ESXi configuration
ntThe next step is to add the storage target to the ESXi configuration. In this example, the IP address is the storage target of the iSCSI SAN in my personal lab. Note the red box with port 3261 configured.
ntiSCSI by default runs on port 3260. My storage product is configured to run on 3261, which is why it is configured as shown.
ntOnce this information is entered, the iSCSI initiator prompts to do a rescan operation. The rescan will detect any storage if already configured on the iSCSI SAN.
ntThe scan will probe the ports configured for vmkernel and attempt to reach the storage processor over the specified configuration.
Check to see if the storage is zoned correctly
ntThe easy way to see if the storage is zoned correctly to the IQN of the ESXi host is immediately shown after the scan is complete. Here, multiple disk targets are visible to the host. In my lab, I allocate 2 TB LUNs for persistent data LUNs for permanent virtual machines and 1 TB LUNs for non-persistent virtual machines. That is the best practice I can have for the single-SAN development environment.
Start wizard to add storage
ntIf there is a LUN ready for the ESXi host, you can click on the u201cAdd Storageu201d link in the Storage section of host configuration. This will start a wizard to add storage to the host and format a new datastore.
Adding LUN to host
ntTo the point earlier that specifies that 1 TB LUNs are for testing purposes, I’ve selected this particular LUN to add to the host.
ntThis next step can be data destructive. Be sure you are proceeding correctly at this point.
Add name and block size
ntThe wizard will then prompt for a name and block size for the datastore. Always choose 8MB for the datastore, even if the LUN size is not greater than 1 TB. There are a lot of factors related to this, but this is one of those decisions that can save havoc later.
Formatting the LUN on the host
ntA summary is presented, so the host can proceed with the format of the LUN on the host. Once the Finish button is presented, the LUN is ready to hold virtual machines or CD-ROM .ISO files for virtual machine installations.
ntThis can be scripted or automated through host profiles, but I find that in lab situations I repetitively build ESXi hosts and their associated storage resources manually.
ntHow do you provision iSCSI storage, especially in lab situations? Share your comments below.