Creating multiple iSCSI LUNs on a single virtual disk (VD)
In the previous document, the entire virtual disk (VD) is used to create a LUN. i.e, if you have a 500GB VD, only a single LUN of 500GB can be created. This document explains about creating multiple LUNs in a single VD. For example, you can create two 200GB LUNs and a 100GB LUN in a 500GB VD.
The concept is we are creating ‘Active volumes’ using VDs, and then multiple LUNs will be created in a single ‘Active volume’. Each LUN of an ‘Active volume’ is like a single file.
1. Here we have a 50GB virtual hard disk as shown below. We will be creating multiple LUNs in this 50GB virtual hard disk
2. The new virtual hard disk is detected
3. Click on ZFS volume manager and then click on manual setup. Select the member disk and give a volume name and click on add volume to create an Active volume
4. Now the Active volume is created
5. Click on change permissions icon at the bottom
6. To configure iSCSI, click ‘Services’ and then then click the small wrench icon next to iSCSI
7. Click Portals on the menu bar at the top of the iSCSI tab. Click Add Portal. Accept the default 0.0.0.0:3260 and click OK
8. Click Initiators -> Add Initiator, accept defaults as ALL and ALL and click OK
9. The next step is to create an extent. This will be the hard disk presented to the Initiator. In fact, it is a file on the FreeNAS server which will act as a virtual hard disk. The size of the file created will determine the size of the iSCSI hard disk. Click Extents and Add Extent as given below :
Click OK and then again click on Add Extent
Click OK. Now, we have created two extents
10. When an iSCSI Initiator connects to an iSCSI server it connects to a Target. To create a Target click Targets and Add Target. Enter a Target Name (eg. target1), select Disk from the Type drop down menu. Select 1 for the Portal Group ID and the Initiator Group ID and click OK
Click OK and add another target by clicking Add Target
Click OK. Two targets are created as shown below
11. Finally the Target needs to be associated with the Extent so that when the iSCSI Initiator connects to the target it uses the corresponding extent. Click Associated Targets and Add Target/ Extent.
Click OK
Click OK
12. Now two iSCSI LUNs are created in a single 50GB VD