Hey there folks, just writing this very quick tip on how to setup an iSCSI storage for your *crash and burn* environment… In this tutorial I will not care for network settings, security or anything, I will just demonstrate the installation and configuration of the storage using the raw devices as luns. (They can be split within FreeNAS and used as extents, but this is for a later post).
You can download this version of FreeNAS in both 32 and 64 bits from the links below:
Create virtual machine
Since the idea is to have a storage simulated using as few resources as possible, I’m using FreeNAS 8.3.0 – 32 bits, create a VM and set the TYPE to BSD and VERSION to FreeBSD (32-bit) — or 64 bit if you are using that architecture for storage.
Set the memory to 512 MB, it will fire an warning during installation but does not block the installation.
Create a new virtual disk, I recommend to leave the default of 16 GB.
Leave the default disk type, VDI.
Dynamically allocated is fine for this setup.
This is the disk where the installation will reside. I’ll leave the default.
As the initiatior (client machine) resides on my physical network, I will change the NIC to Bridged mode.
In the storage tab, I’ve added a SCSI controller and created 3 disks will be later on used as LUNS, I also inserted the iso image in the CD drive.
Here is an overview of the machine ready to begin the installation.
When you boot the machine, you will be presented the Console Setup, select option 1 and hit Enter.
Select the drive ada0 which is the IDE disk where the installation will reside.
Select NO when prompted if you want to preserve existing parameters, as this is a fresh install.
Select YES to format and proceed.
The installation takes 1 minute and a few seconds on my hardware (which is not that good).
After rebooting you will see the IP obtained from DHCP. You can set a static IP in option 1 but I am using the default here just to demonstrate the storage setup.
Browse to the IP address of FreeNAS and click on “Services”.
Locate iSCSI and click on the tool icon to configure it before turning it on.
This step is necessary just for older versions of FreeNAS, select “Enable LUC” and change the “Controller Auth Method” to “None”.
Go to the Portals tab and add the portal. I’ll leave the IP address to 0.0.0.0 and the default TCP Port 3260.
Move on to Initiators tab and configure the initiators according to your needs, I will just leave ALL and ALL, because I don’t intend to setup authentication for this storage.
Now, on Targets tab, create the target name which will be servicing the Luns to the Initiators. I will follow the standard naming convention (iqn.YYYY-MM) which is usually when the iSCSI target was created, in my example: iqn.2017-05 + storage + purpose. (I’m not sure if there’s a convention for what follows the month).
Notice I have also disabled the authentication and set the Portal Group ID and Initiator Group ID to 1, which is what was created in previous tabs.
Now on the Device Extents tab, just click on Add Device Extent button and assign the devices you want to be presented as LUNs.
Finally, on the “Associated Targets” tab, assign the luns to the target.
Back to Services, just change the switch from OFF to ON and you are good to go.
Present LUNs to the server
Now go to the server you want to present the luns and install the package iscsi-initiator-utils
[oracle@mustang ~]$ su - Password: [root@mustang ~]# dnf -y install iscsi-initiator-utils Fedora 25 - x86_64 - VirtualBox 243 kB/s | 33 kB 00:00 Fedora 25 - x86_64 - Updates 1.1 MB/s | 23 MB 00:20 google-chrome 24 kB/s | 3.8 kB 00:00 Last metadata expiration check: 0:00:01 ago on Sun May 21 09:30:23 2017. Package iscsi-initiator-utils-184.108.40.2063-34.git4c1f2d9.fc25.x86_64 is already installed, skipping. Dependencies resolved. Nothing to do. Complete!
Now connect to the portal and request the target as in the example below:
[root@mustang ~]# iscsiadm -m discovery -t sendtargets -p 192.168.1.225 192.168.1.225:3260,1 iqn.2017-05.freenas.oracleasm
Now if we look at the devices, we still can’t see the LUNs:
[root@mustang ~]# ls -la /dev/sd* brw-rw----. 1 root disk 8, 0 May 19 15:34 /dev/sda brw-rw----. 1 root disk 8, 1 May 19 15:35 /dev/sda1 brw-rw----. 1 root disk 8, 2 May 19 15:34 /dev/sda2 brw-rw----. 1 root disk 8, 3 May 19 15:34 /dev/sda3 brw-rw----. 1 root disk 8, 16 May 21 08:50 /dev/sdb brw-rw----. 1 root disk 8, 17 May 21 08:58 /dev/sdb1
To finish it up, login to the target and the devices are presented.
[root@mustang ~]# iscsiadm -m node --login Logging in to [iface: default, target: iqn.2017-05.freenas.oracleasm, portal: 192.168.1.225,3260] (multiple) Login to [iface: default, target: iqn.2017-05.freenas.oracleasm, portal: 192.168.1.225,3260] successful.
Now we can see the LUNs and you can proceed to configure them with udev rules, asmlib, etc.
[root@mustang ~]# ls -la /dev/sd* brw-rw----. 1 root disk 8, 0 May 19 15:34 /dev/sda brw-rw----. 1 root disk 8, 1 May 19 15:35 /dev/sda1 brw-rw----. 1 root disk 8, 2 May 19 15:34 /dev/sda2 brw-rw----. 1 root disk 8, 3 May 19 15:34 /dev/sda3 brw-rw----. 1 root disk 8, 16 May 21 08:50 /dev/sdb brw-rw----. 1 root disk 8, 17 May 21 08:58 /dev/sdb1 brw-rw----. 1 root disk 8, 32 May 21 09:33 /dev/sdc brw-rw----. 1 root disk 8, 48 May 21 09:33 /dev/sdd brw-rw----. 1 root disk 8, 64 May 21 09:33 /dev/sde
Hope this helps.