Solaris -- iSCSI

Aus RZ-Amper Wiki
Zur Navigation springen Zur Suche springen


Setting Up Your Solaris iSCSI Target Devices

The basic process is as follows:

  • Identify the backing store directory – For each target and logical unit that is created, the iSCSI daemon needs to store some information. By default, the backing store for this device is also located in the base directory. So, if the host system has a large ZFS pool to use, it might be easiest to allow the daemon to store everything in that location. If the backing store needs to be spread out, it's possible to specify the backing store location during the creation of each logical unit.
  • Create the iSCSI target – By default, the CLI assumes that the requested device type is an LBA of logical unit 0. If a pass through mode is desired for character devices, the -raw option must be used. After the creation of the first LUN, other LUNs might be created for the same iSCSI target by specifying -lun number.

The daemon starts a background task that initializes the LUN to zeros. If, during that initialization, the underlying file system becomes 100 percent full, the daemon removes the target. During this initialization, the LUN is marked as being offline and cannot be used by an initiator. During this time, however, it is possible to have an initiator discover this LUN. The Solaris initiator waits until it receives an Inventory Change notification and then automatically brings the device online.

This procedure assumes that you are logged in to the local system that contains the iSCSI targets.

1. Become superuser.

2. Identify the base directory. The base directory is used to store the iSCSI target configuration data, and needs to be defined prior to using the iSCSI target for the first time.

 vidar/# mkdir -p /var/iscsi1/volume1
 vidar/# iscsitadm modify admin -d /var/iscsi1/volume1

3. Create a backing store. The backing store contains the physical data storage that is exported as a target. The Solaris target supports several types of backing stores:

  • Flat files
  • Physical devices
  • SVM meta devices
  • ZFS volumes

To create a backingstore from a ZFS volume, the zfs utility can be run with the create subcommand, the create zvol option ("-V"), the size of the zvol to create, and the name to associate with the zvol.

 vidar/var# zfs create -V 4G iscsi1/volume1
 vidar/var# zfs list
 NAME             USED  AVAIL  REFER  MOUNTPOINT
 iscsi1          4.13G   716M  34.9K  /iscsi1
 iscsi1/volume1  4.13G  4.83G  26.6K  -


4. Once a backing store has been created, it can be exported as an iSCSI target with the iscsitadm "create" command, the "target" subcommand, and by specifying the backing store type to use.

 vidar/# iscsitadm create target -b /dev/zvol/dsk/iscsi1/volume1 vidar-volume1

5. To get a list of all targets you have to issue the following command. The option -v will show you the LUN ID, which is needed to delete a target.

 vidar/# iscsitadm list target -v

6. To delete the target you have to issue the following command.

 vidar/# iscsitadm delete target -u 0 ismine-volume01