h1. How to Create a Thin-Provisioned SCSI Logical Unit
{toc:type=list|minlevel=2|maxlevel=3}
*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 thin-provision logical unit:
* The maximum size supported by COMSTAR for thin-provisioned logical units is 8 exabytes (8192 petabytes). This size might 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 situation, implement dynamic logical unit expansion as described in [How to Dynamically Grow a Thin-Provisioned SCSI Logical Unit|How to Create a Thin-Provisioned SCSI Logical Unit#How to Dynamically Grow a Thin-Provisioned SCSI Logical Unit].
h2. How to Create a Thin-Provisioned SCSI Logical Unit
This procedure shows you how to initialize a zero-byte file, and establish a 1-Tbyte backing store.
# Initialize the file to be used as the logical unit. This example uses a file named {{lu1}}.
{code}
# touch /lu1
{code}
# Create a logical unit using a 1-Tbyte backing store.
{code}
# sbdadm create-lu -s 1T /lu1
{code}
{code}
Created the following LU:
GUID DATA SIZE SOURCE
-------------------------------- ------------------ --------------------
6000ae40c5000000000047a22c1c0001 1099511562240 /lu1
{code}
# Verify the creation of the logical unit.
{code}
# sbdadm list -lu
{code}
# View the initial size of the logical unit.
{code}
# ls -l /lu1
{code}
{code}
-rw-r-r- 1 root root 8192 April 7 11:12 /lu1
{code}
h2. How to Dynamically Grow a Thin-Provisioned SCSI 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 changes the size of a 10-Gbyte logical unit to 1500 Gbytes.
{info:title=Important 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.
{info}
# Change the size of the logical unit.
{code}
# sbdadm modify-lu -s 1500 /lu_0_store
{code}
{code}
LU modified successfully.
{code}
# View the size of the logical unit.
{code}
# sbdadm list-lu
{code}
{code}
Found 1 LU(s)
GUID DATA SIZE SOURCE
-------------------------------- ------------------- ----------------
6000ae4000144f972b2e486291410001 1610612670464 /lu_0_store
{code}
h2. Where to Go Next
* [How to Make SCSI Logical Units Available]
* [How to Configure an iSCSI Target for Discovery]
{toc:type=list|minlevel=2|maxlevel=3}
*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 thin-provision logical unit:
* The maximum size supported by COMSTAR for thin-provisioned logical units is 8 exabytes (8192 petabytes). This size might 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 situation, implement dynamic logical unit expansion as described in [How to Dynamically Grow a Thin-Provisioned SCSI Logical Unit|How to Create a Thin-Provisioned SCSI Logical Unit#How to Dynamically Grow a Thin-Provisioned SCSI Logical Unit].
h2. How to Create a Thin-Provisioned SCSI Logical Unit
This procedure shows you how to initialize a zero-byte file, and establish a 1-Tbyte backing store.
# Initialize the file to be used as the logical unit. This example uses a file named {{lu1}}.
{code}
# touch /lu1
{code}
# Create a logical unit using a 1-Tbyte backing store.
{code}
# sbdadm create-lu -s 1T /lu1
{code}
{code}
Created the following LU:
GUID DATA SIZE SOURCE
-------------------------------- ------------------ --------------------
6000ae40c5000000000047a22c1c0001 1099511562240 /lu1
{code}
# Verify the creation of the logical unit.
{code}
# sbdadm list -lu
{code}
# View the initial size of the logical unit.
{code}
# ls -l /lu1
{code}
{code}
-rw-r-r- 1 root root 8192 April 7 11:12 /lu1
{code}
h2. How to Dynamically Grow a Thin-Provisioned SCSI 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 changes the size of a 10-Gbyte logical unit to 1500 Gbytes.
{info:title=Important 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.
{info}
# Change the size of the logical unit.
{code}
# sbdadm modify-lu -s 1500 /lu_0_store
{code}
{code}
LU modified successfully.
{code}
# View the size of the logical unit.
{code}
# sbdadm list-lu
{code}
{code}
Found 1 LU(s)
GUID DATA SIZE SOURCE
-------------------------------- ------------------- ----------------
6000ae4000144f972b2e486291410001 1610612670464 /lu_0_store
{code}
h2. Where to Go Next
* [How to Make SCSI Logical Units Available]
* [How to Configure an iSCSI Target for Discovery]