OpenSolaris

You are not signed in. Sign in or register.

Getting Started with COMSTAR

For information regarding downloading and installing COMSTAR refer to the Downloading and Installing section.

Creating and exporting LUNs



The process involves 3 basic steps:

(a) Initializing the storage for SCSI Logical unit.
(b) Creating a SCSI Logical Unit (LU) using the backing store.
(c) Applying the required LUN mappings to export this LU to initiators.

We will look into these steps in more detail.

Initialize the storage for the LU.
The LU provider for creating disk type logical units is sbd. To export a disk type logical unit, sbd needs the backing store for the disk. This can be a regular file or a raw device like a disk or zvol. There are a variety of options available to initialize the backing store. A very simple case is shown in the example below. See Thin provisioning section for more details.

# touch /lun0
#

In the example above we just created a zero byte file. We will be able to specify the size of the LU during the initialization process. The disk space will be used as the LU grows.

If you want to reserve the disk space for the backing store, you can use mkfile(1) to create the backing store file.

Another option is to use a zvol and take advantage of the zfs filesystem in solaris.

Creating a SCSI LU using the backing store.
The sbdadm create-lu command initializes the backing store and registers the LU with the framework.

# sbdadm create-lu -s 50g /lun0
 
Created the following LU:
 
          GUID                    DATA SIZE           SOURCE
------------------------------—  -----------------—  --------------—
6000ae401d000000000047bc7aba0001      53687025664      /lun0
#

Mapping the LU to initiator(s).
Simply registering a logical unit with the framework will not make it available for the initiators. It needs to be mapped to the required set of initiators through the required set of target ports. There are a variety of options available to do this and they are discussed in more details inside the LUN Mapping and Masking section. In its simplest form, the following command will export this LU to all the initiators via all the target ports with an appropriate LUN number (picked by the framework).

# stmfadm add-view 6000ae401d000000000047bc7aba0001
#

At this point the initiator(s) should be able to see the Logical unit you exported.

On windows based initiator(s) you may have to 'scan for configuration changes' in the device manager.

On solaris based initiator(s), if this is the 1st LUN from this target port, you can force enumeration by running the following script.

#!/bin/ksh
fcinfo hba-port |grep "^HBA" |awk '{print $4}'|while read ln
do
        fcinfo remote-port -p $ln -s >/dev/null 2>&1
done

On Solaris all the subsequent LUNs should show up in the format output automatically. For the subsequent LUNs, the first I/O from the system (like from running format) causes the system to do the rediscovery and format might not show the LUNs yet as the discovery process is still going on. In that case you can issue the format command again and LUNs should show up. In any case, running the above script will force the initiator to touch all the LUNs.If you are still not seeing the LUNs, make sure that service is online on the target (by running 'svcs stmf') and make sure that you have added view entries for the LUN as described above in the LUN mapping section.