OmniCube Reference Manualcreate_iscsi_lun.sh(8)

create_iscsi_lun.sh(8)

System Administration Commands · OmniCube · August 10, 2026

NAME

create_iscsi_lun.sh - create and export the main and SLOG iSCSI LUNs of a zone

SYNOPSIS

/opt/omnicube/sbin/create_iscsi_lun.sh zone size

DESCRIPTION

create_iscsi_lun.sh creates the two COMSTAR logical units that back one zone over iSCSI: a main LUN of the requested size on the host's main pool, and a fixed 10 GB SLOG LUN on the host's NVMe pool. Both are backed by sparse raw files inside their own ZFS dataset, and both are exported to every initiator by adding a view with no host group and no target group. It is an operator command, run once per zone.

Pool names are derived from the short host name, that is the output of hostname truncated at the first hyphen:

main_pool

The short host name itself. Holds main_pool/iscsi/zone mounted by default at /main_pool/iscsi/zone, containing zone-lun0.raw of size GB.

slog_pool

The short host name with -nvme appended. Holds slog_pool/iscsi-slog/zone containing zone-slog-lun0.raw, always 10 GB.

Both halves are idempotent in two ways. The dataset and the raw file are only created when the raw file does not already exist, and the logical unit is only created when stmfadm list-lu -v does not already mention that raw file, in which case the command returns without touching the existing LU or its view. Otherwise stmfadm create-lu is run, its GUID is taken from the created line of the output, and stmfadm add-view publishes it; the GUID and the backing file are printed on success.

This command runs entirely on the local host. It does not talk to the other cluster nodes and does not read config/nodes. The shared run-level guard applies: the command exits 0 without doing anything when the host is at run level 0, 1, 5, 6, S or s, or when /etc/nologin exists, unless OC_IGNORE_RUNLEVEL is set.

OPERANDS

zone

Name of the zone the LUNs belong to. Mandatory. Used as the dataset name and as the raw file name prefix, and must match [a-zA-Z0-9][a-zA-Z0-9._-]*.

size

Size of the main LUN in GB. Mandatory. Must be a positive integer greater than zero. The SLOG LUN size is not configurable and is always 10 GB.

This command takes no options.

EXAMPLES

Example 1: create a 200 GB main LUN and its SLOG for a zone

create_iscsi_lun.sh zbeio01 200

Example 2: verify what was exported

pfexec stmfadm list-lu -v
pfexec stmfadm list-view -l <guid>

Example 3: re-run after a partial failure

create_iscsi_lun.sh zbeio01 200

Existing raw files and existing logical units are left alone, so a re-run only completes what is missing.

EXIT STATUS

0

Both LUNs exist and are exported, whether they were created now or already present.

1

A missing operand, a zone name that failed validation, or a size that is not a positive integer greater than zero.

2

stmfadm create-lu returned no GUID, or stmfadm add-view failed, for either the main or the SLOG LUN.

78

Raised while sourcing the shared library when config/site is not set on the selected SMF instance.

FILES

/opt/omnicube/sbin/create_iscsi_lun.sh

This command.

/opt/omnicube/lib/common/utils.sh

Shared library: SMF configuration, logging, validation, run-level guard.

/main_pool/iscsi/zone/zone-lun0.raw

Backing file of the main logical unit.

/slog_pool/iscsi-slog/zone/zone-slog-lun0.raw

Backing file of the 10 GB SLOG logical unit.

ENVIRONMENT

OC_SMF_INSTANCE

Selects the svc:/omnicube/sysadm instance whose config/site value is read when the shared library is sourced.

OC_IGNORE_RUNLEVEL

When set to a non-empty value, bypasses the run-level guard.

SECURITY

The zfs, truncate and stmfadm calls run under pfexec, using the root-equivalent OmniCube Administration profile. Both operands are validated before they reach a dataset name, a file path or an stmfadm command line: the zone name against the standard name pattern, the size as a strictly positive integer, which also rules out the silent creation of a zero-length logical unit.

SEE ALSO

omnicube_utils(3), oc_validate(3), omnicube(7), create_zone_config.sh(8), create_zone_pool.sh(8), get_vm_disk_info.sh(8), manage_zone.sh(8), pool_monitor.sh(8).

NOTES

stmfadm add-view is called without a host group or target group, so each logical unit is visible to every initiator that can reach the target. Restrict access with target and host groups, or at the network level, if that is not what you want.

The parent datasets main_pool/iscsi and slog_pool/iscsi-slog are expected to exist already; zfs create is only called for the per-zone child.

The SLOG pool name is derived, not verified. On a host without a <short_host>-nvme pool the SLOG half fails, after the main LUN has already been created and exported.

man8/create_iscsi_lun.sh.8generated 2026-09-02 05:17 CEST