OpenSolaris 2008.11 COMSTAR Administration Guide
Previous Next

Creating SCSI Logical Units

The logical unit provider for creating disk-type logical units is called sbd. However, before you can export a disk-type logical unit, you have to initialize the storage for the logical unit.

The process for creating SCSI logical units includes the following steps:

  1. Initializing the storage for the logical unit, also known as the backing store

  2. Creating a SCSI logical by unit using the backing store

When the logical unit is created it is assigned a global unique identifier (GUID), for example, 6000ae4000144f972b2e486291410001. The GUID is used in subsequent tasks to refer to the logical unit, for example, mapping a logical unit to select hosts.

This section shows you how apply this process by creating SCSI logical units in the following ways:


Note - Determine which backing store is best suited for the available capacity on the SCSI target.


Using a Regular File Backing Store

This section covers the following ways to create a logical unit by using a regular file backing store:

Thin-provisioning enables you to create a logical unit of a specific size, for example, 100 gigabytes, without allocating any storage space right away. You define the allotted size so that the target mode software can communicate that information to initiators when prompted for the size of the logical unit. However, the actual space for the logical unit's back-end storage is only allocated when the initiators write data to that space.

Dynamic logical unit expansion enables you to skip defining the allotted size for the logical unit. You can simply define the space that you need today and later grow the size as the demand for space increases. This method is beneficial when you do not want to allocate the space up-front for a large, thin-provisioned logical unit.

Consider the following before creating a file logical unit:

  • The maximum size supported by COMSTAR for thin-provisioned logical units is 8 exabytes (8192 petabytes). This size may be limited by the constraints of the underlying file system, on which the backend storage pool resides. For example, UFS does not support more than 2 terabytes of logical units. However, ZFS allows for up to 8 exabytes of logical units.

  • Without thin-provisioning, the logical unit size is derived from the size of the file or device at the time the logical unit is initialized.

  • Some applications on the initiator side try to write to the entire disk as part of their initialization sequence when formatting the disk. This type of initiator action forces the target to immediately allocate all the space from the back-end storage. To prevent this from happening, you should implement dynamic logical unit expansion, as described inTo Dynamically Grow a Logical Unit.

To Create a Regular File-Based Logical Unit

This procedure shows you how to create a regular file-based SCSI logical unit, with a 10–Gbyte backing store.

  1. Initialize the file. This example uses a 10–Gbyte file.
    # mkfile 10g /lu_0_store 
  2. Create a logical unit by using a backing store.
    # sbdadm create-lu /lu_0_store
    Created the following LU:
    
             GUID                         DATA SIZE           SOURCE
    --------------------------------  -------------------  ----------------
    6000ae4000144f972b2e486291410001      10737352704      /lu_0_store 
  3. To make this logical unit available, you must add a view. For more information, see Making a Logical Unit Available.
To Create a Thin-Provisioned File Logical Unit

This procedure shows you how to initialize a zero-byte file, and establish a 1–Tbyte backing store.

  1. Initialize the file to be used as the logical unit. This example uses a file named lu1.
    # touch /lu1
  2. Create a logical unit, using a 1–Tbyte backing store.
    # sbdadm create-lu -s 1T /lu1
    Created the following LU:
    
    GUID                                DATA SIZE             SOURCE
    -------------------------------- ------------------ --------------------
    6000ae40c5000000000047a22c1c0001    1099511562240           /lu1
  3. View the initial size of the logical unit.
    # ls -l /lu1
    -rw-r-r- 1 root root 8192 April 7 11:12 /lu1
  4. To make this logical unit available, you must add a view. For more information, see Making a Logical Unit Available.
To Dynamically Grow a Logical Unit

Dynamic logical unit expansion enables you to change the size of an existing logical unit dynamically with the modify-lu option (supported by sbd). This example takes a 10–Gbyte logical unit and changes its size to 1500 Gbytes.


Note - When the size of a logical unit is modified, the initiators currently accessing the logical unit are notified, through a SCSI check condition, that CAPACITY HAS CHANGED. The initiators and file systems on the initiators must be capable of handling this notification, and capable of adjusting the size accordingly.


  1. Change the size of the logical unit.
    # sbdadm modify-lu -s 1500 /lu_0_store
    LU modified successfully.
  2. View the size of the logical unit.
    # sbdadm list-lu
    Found 1 LU(s)
    
             GUID                         DATA SIZE           SOURCE
    --------------------------------  -------------------  ----------------
    6000ae4000144f972b2e486291410001     1610612670464      /lu_0_store 

Using a Raw Disk Device Backing Store

Raw storage devices can also be used as a backing store, just like regular files. Examples are raw storage devices under the /dev/dsk or /dev/rdsk directory. The following task shows you how to create a logical unit by using a disk partition.

To Create a Disk Partition Logical Unit

  1. Create a logical unit by using a specific disk partition. In this example, the disk partition specified is c1t0dos2.
    # sbdadm create-lu /dev/rdsk/c1t0dos2
  2. To make this logical unit available, you must add a view. For more information, see Making a Logical Unit Available.

Using a ZFS Volume Backing Store

ZFS, a file system that is part of OpenSolaris, combines the functionality of a file system and a volume manager. ZFS enables you to easily create storage pools and volumes that can provide data services, such as RAID, mirroring, snapshots, clones, and much more. For more information about ZFS, see the Solaris ZFS Administration Guide.

The following procedure initializes a ZFS volume and creates a logical unit as a backing store in three steps. First you create a ZFS storage pool. Then you divide the zpool into ZFS volumes. And finally, you create a logical unit by using a ZFS volume.

To create a ZFS pool, or zpool, use the zpool create command. In this example, the zpool uses six disks. The disks are located in the /dev/rdsk directory. The disks are labeled by ZFS, so they contain a single large slice and the data is dynamically striped across a slice. See the zpool(1M) man page for more information.

To Create a ZFS Volume Logical Unit
  1. Create a RAID-Z storage pool.
    # zpool create pool_1 raidz c0t0d0 c0t1d0 c0t2d0 c0t3d0 c0t4d0 spare c0t5d0
  2. Create a 100–Gbyte volume named zvol1.
    # zfs create -V 100G pool_1/vol_1
  3. Create a logical unit by using the volume.
    # sbdadm create-lu /dev/zvol/rdsk/pool_1/vol_1
    Created the following LU:
    
                  GUID                    DATA SIZE           SOURCE
    --------------------------------  -------------------  ----------------
    6000ae40980000000000486a6f930002      107374116864     /dev/zvol/rdsk/pool_1/vol_1
  4. To make this logical unit available, you must add a view. For more information, see Making a Logical Unit Available.
Previous Next