mkvdiskhostmap

Use the mkvdiskhostmap command to create a new mapping between a volume and a host, which makes the volume accessible for input/output (I/O) operations to the specified host.

Syntax

mkvdiskhostmap [ -force ] -host { host_id | host_name } [ -scsiscsi_num_arg ] { vdisk_name | vdisk_id }

Parameters

-force
(Optional) Allows multiple volume-to-host assignments, which are not normally allowed.
-hosthost_id | host_name
(Required) Specifies the host to map the volume to, either by ID or by name.
-scsiscsi_num_arg
(Optional) Specifies the Small Computer System Interface (SCSI) logical unit number (LUN) ID to assign to this volume on the given host. The scsi_num_arg parameter contains the SCSI LUN ID that is assigned to the volume on the given host for all I/O groups that provide access to the volume. You must check your host system for the next available SCSI LUN ID on the given host bus adapter (HBA). If you do not specify the -scsi parameter, the next available SCSI LUN ID in each I/O group that provides access is provided to the host. The -scsi parameter is not supported for NVMe hosts. When a volume is mapped to a host that uses the NVMe protocol, the volume namespace ID (NSID) is assigned by the system.
vdisk_name | vdisk_id
(Required) Specifies the name of the volume that you want to map to the host, either by ID or by name.

Description

This command creates a new mapping between the volume and the specified host. The volume is presented to the host as if the disk is directly attached to the host. It is only after this command is processed, that the host can perform I/O transactions to the volume.

Optionally, you can assign a SCSI LUN ID to the mapping for SCSI hosts. When the HBA in the host scans for devices that are attached to it, it discovers all volumes that are mapped to its Fibre Channel ports. When the devices are found, each one is allocated an identifier (SCSI LUN ID). For example, the first disk found is usually SCSI LUN 0, and so on. You can control the order in which the HBA discovers volumes by assigning the SCSI LUN ID, as required. If you do not specify a SCSI LUN ID, the cluster automatically assigns the next available SCSI LUN ID, if any mappings already exist with that host. When you issue the mkvdiskhostmap command, the assigned SCSI LUN ID number is returned.

For NVMe, the SCSI LUN ID is irrelevant and instead the system assigns the NSID that cannot be changed. When you create a mapping to an NVMe volume, the NSID is returned (The NSID is the vdisk_ID + 1).

The mkvdiskhostmap command fails if the:
  • Host to which this mapping is being made is not associated with any one of the I/O groups in the volume access set
  • Volume has more than one I/O group in its access set and the host being mapped to the volume does not support volumes being mapped from multiple I/O groups
  • If the host protocol is incompatible with the volume protocol
  • If the volume has more than one access IO group and the host protocol is NVMe
Remember: iSCSI hosts can access volumes that are accessible through multiple I/O groups (as well as single I/O groups).

If you generate different SCSI LUN IDs, only one is returned. The returned ID is for the highest-numbered I/O group to which the volume was mapped. To view other values, issue lshostvdiskmap or lsvdiskhostmap.

The SCSI LUN ID is used for the highest numbered I/O group to which the volume is mapped.

Some HBA device drivers stop when they find a gap in the SCSI LUN IDs. For example:
  • Volume 1 is mapped to Host 1 with SCSI LUN ID 1
  • Volume 2 is mapped to Host 1 with SCSI LUN ID 2
  • Volume 3 is mapped to Host 1 with SCSI LUN ID 4

When the device driver scans the HBA, it must stop after identifying volumes 1 and 2, because no SCSI LUN is mapped with ID 3. For optimal performance, ensure that the SCSI LUN ID allocation is contiguous.

You can create multiple volume assignments (assigning the same volume to multiple hosts, for example, which might be particularly useful for clustered system hosts assigning a volume to multiple hosts). Normally, multiple volume-to-host assignments are not used because corruption is likely to occur if more than one host can access a disk. However, in certain multiple path environments, a volume must be mapped to more than one host. This includes the IBM SAN File System. To map to more than one host, you must use the mkvdiskhostmap command with the -force parameter. For example: mkvdiskhostmap -host host1 -force 4 mkvdiskhostmap -host host2 -force 4.
Note: When assigning the same volume to multiple hosts, you should use the same SCSI ID for all hosts.

These commands create two host-to-volume mappings for volume 4 that map to host1 and host2. Omitting the -force parameter causes the mapping to fail if that volume is already mapped to a host.

The command also fails if the host object (to which this mapping is being made) is not associated with the I/O group containing the volume.

If a new mapping is created between a host (type hide_secondary) and a volume that is a secondary volume in a remote copy relationship, the:
  • Mapping is created for configuration purposes (it can be changed or deleted)
  • Secondary volume is not presented to the host
The mapped volume is presented to the host if the:
  • Host type is changed to a type other than hide_secondary
  • Remote copy relationship is stopped by specifying -access
  • Volume is no longer a secondary volume because the remote copy relationship is deleted or switched
Note: You cannot specify this command if the volume is an auxiliary volume in an active-active relationship or if a volume is a change volume in any type of relationship.
Remember: This command cannot be used on a volume owned by a filesystem.

An invocation example

mkvdiskhostmap -host host1 -scsi 1 5

The resulting output:

Virtual Disk to Host map, id [1], successfully created