So you want to use FreeNAS Corral to host your VMware ESXi datastores or any other server that needs iSCSI storage?
FreeNAS Corral has removed a lot of features from the GUI. You need to do a lot of advanced options from the CLI. No worries! Once you get to know the CLI a little bit better, you will find your way.
You can follow this guide to create a iSCSI LUN that will be presented to your server. In my case, two VMware ESXi hosts.
I have built a small server including:
1 Xeon E3 1220 V2
16 GB RAM (the more the merrier!)
4 normal SATA disks (750 GB each) and 2 SSD’s (128 GB each). The normal disks are used for data and the SSD’s are used for caching. I’m not using ZIL at the moment.
2 onboard NIC’s and an extra 4-port network card. These 4 extra NIC’s are used to serve the iSCSI LUN’s and are connected to a separate switch and VLAN.
1 32 GB USB-drive that is used as boot device. FreeNAS advices to boot from USB-drive. This way you will have all your disks available for storage pools.
First make sure you have configured all standard items such as hostname, administrative network. You can do this using the GUI. Make sure the SSHD service has been enabled so you can use PuTTY to connect to the FreeNAS system. You can find the SSHD service here: Services –> Management –> SSHD
- Login to the FreeNAS system using PuTTY or any other tool.
- At the command prompt, type CLI to start the FreeNAS CLI.
- First create a Volume. Because I have 4 disks for data, I’m using RAIDZ1 (RAID5).
Show the available disks.
/ volume show
The available disks are ada0, ada1, ada2, ada3, ada4, ada5 and da0. The da0 disk is the USB drive used for booting. Disk ada0 and ada1 are the SSD’s and the others are the normal disks.
Create a volume.
/ volume create volume1 type=raidz1 disks=ada2,ada3,ada4,ada5 cache=ada0,ada1 layout=virtualization
This will create a volume named ‘volume1’ that contains disks ada2, ada3, ada4 and ada5. Disk ada0 and ada1 are used for caching. The layout is virtualization, because this volume will be used for a VMware ESXi datastore.
Show all volumes:
/ volume show
Show the volume that you just created:
/ volume volume1 show
- Configure the iSCSI NIC’s.
Show the available NIC’s.
/ network interface show
The available NIC’s are em0, em1, igb0, igb1, igb2 and igb3. NIC’s em0 and em1 are the onboard NIC’s. NIC’s igb0 to igb3 will be used for iSCSI.
Enable the NIC’s and add a description.
/ network interface igb0 set description=iSCSI01 enabled=yes
/ network interface igb1 set description=iSCSI02 enabled=yes
/ network interface igb2 set description=iSCSI03 enabled=yes
/ network interface igb3 set description=iSCSI04 enabled=yes
Add ip addresses to the NIC’s.
/ network interface igb0 alias create address=10.0.1.10 netmask=255.255.255.0
/ network interface igb1 alias create address=10.0.2.10 netmask=255.255.255.0
/ network interface igb2 alias create address=10.0.3.10 netmask=255.255.255.0
/ network interface igb3 alias create address=10.0.4.10 netmask=255.255.255.0
- Enable iSCSI.
/ service iscsi config set enable=yes
- Create an authentication policy.
/ share iscsi auth create iscsi-auth1 policy=NONE
I’m not using CHAP, therefore the policy is NONE.
FreeNAS 9.x had the ability to use initiator groups. FreeNAS 10 does not have initiator groups anymore. If you need to shield your iSCSI LUN to unwanted server, use CHAP.
- Create an iSCSI portal and bind the iSCSI ip addresses.
/ share iscsi portals create iscsi-portal1 listen=10.0.1.10,10.0.2.10,10.0.3.10,10.0.4.10
- Create an iSCSI share.
For this example I will create a 1,5 TB share on volume1 with blocksize 512 bytes and 5400 rpm.
/ share iscsi create iscsi-share1 parent=volume1 size=1536G block_size=512 rpm=5400
- Create an iSCSI target.
/ share iscsi targets create iqn.2005-10.org.freenas.ctl.iscsi-share1
- Bind the iSCSI share to the iSCSI target.
/ share iscsi targets iqn.2005-10.org.freenas.ctl.iscsi-share1 luns create name=iscsi-share1 number=0
You are now ready to point your ESXi hosts or any other iSCSI client to your FreeNAS system using the ip adresses 10.0.1.10, 10.0.2.10, 10.0.3.10 and 10.0.4.10.