In this blog we’re going to work through connecting your FreeNAS box to your ESXi server for easy backups. ESXi is a hypervisor from VMware that is arguably the best ever made. I like it the most because of many reasons, including the fact that it’s free, it’s a non-Microsoft product, and if you need additional features, the licensing is reasonably priced.
Now, I’ve already gone through and setup my whole server, so what I’ll do is just retrace my steps here and show how easy this process really is.
Lets get started with FreeNAS. I have an old computer that I used for setting up FreeNAS. It’s an ASUS motherboard with an Intel Core 2 Quad (Q6600), 12GB of DDR2 memory, and 6x Western Digital 3TB Disks. I did a basic install on the system, and I’m running the OS from a SanDisk 8GB USB thumb drive. Microcenter has them cheap, so I grabbed a bunch for redundancy.
After you have FreeNAS installed and running with a ZFS volume of your choice, that’s the point that I’ll be starting with here. My need for an iSCSI target was brought on by the need for backups. While I am running a RAID 10 on my ESX server (there are 2 striped RAID arrays mirrored, 1+0), the redundancy still wasn’t enough for my peace of mind. SAS drives can fail at any time, and since my environment is pretty high availability, I didn’t want to take a chance losing 2 drives in my ESX server and losing all my data.
So I have a dilemma, spend a lot of money on backup software, or connect my ESXi server to my FreeNAS server. Seems pretty cut and dry to me, so I’ll backup my VM guests from the ESXi server and save money at the same time.
Start of at your FreeNAS web interface. Go to the Services section and click on “Control Services”. You should see a screen like this. If you never setup iSCSI before, then you’ll need to turn on the “iSCSI” service. After you start the service, go ahead and click on the wrench icon next to the on/off switch.
In the “Target Global Configuration” section, fill out the info that you need to so that it pertains to your environment. The biggest item here is to make sure that the “Enable LUC” option is ENABLED. If it isn’t your iSCSI target won’t ever show up in ESXi.
From there, now go to the “Portals” tab. And click on “Add Portal”. If you have multiple NICs in your FreeNAS box, you may want a direct link to your FreeNAS box with an Ethernet Cable. If so, select the adapter you expect it to be on, otherwise you can leave it as “0.0.0.0”. You’ll want to keep the port number set as 3260.
Now go to the Initiators tab. Click on “Add Initiator”. You can leave it set to “ALL” for both, but I would recommend at least setting it up for the network or host that you expect to connect from.
Now go to the “Targets” tab. Make the target name and alias “esxi”, leave the serial number as-is, Target Flags should be “Read-Write”, your dropdown menus for Portal and Initiator should be available from the ones you setup previously, and then click “OK”.
Now head on over to the Extents tab. Name the Extent “esxi”. What I did is create a folder on my existing ZFS volume named “iSCSI”, which is located in the “/mnt/primary/iSCSI” path. Then just type the file name that you want to use. In my path it looked like this: “/mnt/primary/iSCSI/esxi.extent”. I allocated 550GB of space because that’s approximately how much space I have on the ESXi server. Then click OK.
Now click on the “Associated Targets” tab. Click on “Add Target / Extent”. Your options should be available in the two dropdown menus. Select those and then click OK.
Looking great so far. Now log in on your ESXi server with the vSphere software. After you log in, go to the “Inventory” view, then click on the “Configuration” tab.
Click on the “Add Networking…” button. Select the option for creating a new “VMkernal” and click “Next >”
From here you can see what network adapters you can choose to assign to your new network. We’re going to use VMNIC3, which is actually Port 4 on our server. Click Next to continue.
Here is where you can assign a name to your network. I like to name things so they can be easily identified. We’re going to name our’s “iscsi”. We’re not using VLANs here, so leave that as NONE, and click “Next” to continue.
Since this is a direct cable connection, we’re going to lock down the network with a subnet where there are only two hosts. We aren’t using the “10.254.254.X” network anywhere so that works too. We will make the secondary adapter in the FreeNAS box “10.254.254.1” and this can be “.2”. Notice the subnet mask ends in 252. That states that there are only 4 IPs in the network, with “.0” being the network, and “.4” as the broadcast. There doesn’t need to be a gateway, so don’t worry about changing that; it’ll never be used. Click “Next” to continue.
This is just a summary page, just click on finish.
Now you’re back to the ” Configuration / Networking ” section. From here you can see your newly added “iscsi” switch that was just added, and see that it is tied to the “vmnic3”.
Now head on over to the “Storage Adapters” link in the left column. We’re going to reuse the Broadcom iSCSI Adapter “vmhba35”. Right click on that adapter and then click “Properties”.
You’ll see this screen come up. From there, click on the “Network Configuration” tab.
We need to bind the adapter to this iSCSI initiator so that our ESX box knows where to send iSCSI traffic. Click on the “Add…” button.
You should see the “iscsi” switch that we just created listed here. Click on that, then click “OK”.
You should now see your “iscsi” virtual switch listed in the “VMkernel Port Bindings” section. Now click on the “Dynamic Discovery” tab.
Click the “Add…” button near the bottom of the window. In the window that appears, type in the IP address of your FreeNAS server. It should be 10.254.254.1 if you set yours up exactly like mine. Otherwise, change it accordingly. Leave the port number default at 3260. Then click “OK”.
After clicking “OK” on the last window, you should see your FreeNAS box listed in the “iSCSI Server Location”. Click the “Close” button on that window.
When you click close, you’ll see a window appear that asks you to rescan the location. Click “OK” on that, and wait for the rescan process. After the rescan, you should see your storage pool show up in the Details pane, as you can see in this screenshot.
From here, all you need to do is Click on the “Storage” link in the left hand column, and then click on the “Add Storage…” link in the upper right hand corner. That will bring you to this screen. From here, just click “Next”.
After you follow the prompts you should see your new Data Store listed.
var _gaq = _gaq || ; _gaq.push(['_setAccount', 'UA-37302584-1']); _gaq.push(['_trackPageview']);
While there’s a ton of individual steps involved here, it’s not that difficult to complete this, nor does it really take that long.