I am currently working on Disaster Recovery in my lab and as a result I have setup 2 sites: Primary and DR site. On both site I am having one vCenter and 2 Esxi hosts.
For centralized storage I am using openfiler v2.99 in my lab and I have created 2 LUN’s (100 GB each) on openfiler which are presented to Esxi hosts at my primary site.
If you are new to openfiler then I would recommend reading this document which I uploaded on VMTN sometime back.
I was looking for a way to create 2 more LUN’s and expose those LUN’s only to Esxi hosts that are on my DR site. I did not wanted that all my Esxi host should have visibility to all LUN’s that are created on openfiler. In short I was looking for LUN Zoning kind of things with openfiler in my home lab.
I have never done this and did not had much Idea on how to achieve that. I started searching google for this but unfortunately there is very little help on this topic available out on internet. I found a cool Blog post by Mike Brown who has demonstrated how to achieve that, but I felt his blog to be a bit complex for newbies so I decided to write my own post on this.
Before diving into how to achieve this in Lab, I would like to first explain my infrastructure a bit:
1 vCenter Server (vcentersrv01.alex.local, Management Network: 192.168.109.20)
2 Esxi hosts (optimus.alex.local & megatron.alex.local, Management Network: 192.168.109.6/7)
1 openfiler (openfiler.alex.local, Management Network: 192.168.109.4).
1 vCenter Server (vcentersrv02.alex.local, Management Network: 192.168.109.21)
2 Esxi hosts (harry.alex.local & ron.alex.local, Management Network: 192.168.109.11/12)
my DR site currently has no shared storage.
Enough of background now. Let’s jump into lab and see how to achieve LUN zoning with openfiler:
1: Add a new disk to your openfiler server.
If you are running openfiler as VM and have added the new disk as SCSI then run below command to get that disk identified by openfiler without rebooting the appliance:
[root@openfiler ~]# echo “- – -” > /sys/class/scsi_host/host0/scan
2: Navigate to systems tab and ensure that the network on which your Esxi hosts are residing is allowed in openfiler.
Note: If you have hosts residing on different subnets then make sure all subnets are added here and your openfiler appliance have access to all subnets.
3: Navigate to Volumes tab and click on block devices to see the newly added disk. You will see it does not contain any partitions yet. Click on the disk to create a new partition.
4: Select partition type as Physical volume and click on Create.
5: Click on Volume Groups to create a new vol group for this disk.
Provide a name for the volume group and select the disk to add to this volume group and click on “Add Volume Group”
6: Now click on Add Volume from right hand side menu to add a volume in the Volume Group created in above step.
7: From Select Volume Group select the newly created VG
Provide a name and description for the Volume and select the size. Under Filesystem select Block(iSCSI,FC) option and hit create button.
Post creation of volume, verify the details such as Volume size etc.
8: Next is to create a new iSCSI target.
The approach here is to create different target and map a subset of LUN’s to each target and then expose only a particular target to the Esxi host. Click on ISCSI targets from right hand side menu and click on Add to add a new target.
Current target in my lab has following name and to this target 2 LUN’s are mapped as explained earlier in the post.
On selecting the existing target and moving on to LUN Mapping tab, I can see the newly created LUN (iSCSI-3) appears in the list but I am not going to map this LUN to current target as it is exposed to Esxi hosts on my primary site.
I created a new target by name “iqn.2006-01.com.openfiler-DR:tsn.877ef7dfaa2b”. Notice the name, I have put DR after openfiler in name so as to make things simple and help me to identify that this target will be only mapped to my DR site. Make a note of this name as we will e needing this while configuring targets on esxi hosts.
As of now this target do not have any LUN’s mapped to it. I am going to map iSCSI-3 to this target.
Once the LUN was mapped to the newly created target, configuration looks like as shown below
9: Verify that your subnet is allowed to access this target.
10: Add a new software iSCSI adapter to Esxi host to access the targets on openfiler devices. Open properties of newly added iSCSI adapter to configure targets.
11: Important: Add the newly added target as Static discovery and not as dynamic discovery. If you select dynamic discovery and provide the IP address of then openfiler applaince here, it is going to discover both of your traget (newly created one and existing one) and as a result all your LUN’s (3 in my case) will start appearing on Esxi host.
On selecting Static Discovery click on Add button, in the newly launched window provide IP/FQDN of your openfiler appliance with 3260 as port and under iSCSI target name paste the name of target which we created in Step 8. Hit OK once you are done with configuration.
11: Perform a rescan of iSCSI adapter and you will see one connected target.
12: Create Datastore
Go to Storage tab on your Esxi host and click on Add Storage.
Select the appropriate LUN id to create datastore on LUN. While writing this post I quickly added a new 50 GB LUN on openfiler and mapped it to the target created for DR site and that is why I am seeing 2 LUN’s here.
13: Verify configuration on Esxi hosts. As you can see Esxi hosts on my Primary and DR site are mounting different LUN’s.
PS: The only configuration change which I did not demonstrated here is that on my Primary Site I removed the targets from dynamic discovery(which I had done at time of building my lab) and added it again as static discovery.
I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing. Be sociable