Linux Command Library



targetcli is a shell for viewing, editing, and saving the configuration of the kernels target subsystem, also known as LIO. It enables the administrator to assign local storage resources backed by either files, volumes, local SCSI devices, or ramdisk, and export them to remote systems via network fabrics, such as FCoE.

The configuration layout is tree-based, similar to a filesystem, and navigated in a similar manner.


targetcli [cmd]

Invoke targetcli as root to enter the configuration shell, or follow with a command to execute but do not enter the shell. Use ls to list nodes below the current path. Moving around the tree is accomplished by the cd command, or by entering the new location directly. Objects are created using create, removed using delete. Use help <cmd> for additional usage information. Tab-completion is available for commands and command arguments.

Configuration changes in targetcli are made immediately to the underlying kernel target configuration. Settings will not be retained across reboot unless saveconfig is either explicitly called, or implicitly by exiting the shell with the global preference auto_save_on_exit set to true, the default.

To export a storage resource, 1) define a storage object using a backstore, then 2) export the object via a network fabric, such as FCoE. backstores/fileio create disk1 /disks/disk1.img 140M Creates a storage object named targetcli supports common size abbreviations like M, G, and T.

In addition to the fileio backstore for file-backed volumes, other backstore types include block for block-device-backed volumes, and pscsi for volumes backed by local SCSI devices. ramdisk backstore creates ram-based storage objects. See the built-in help for more details on the required parameters for each backstore type.Exporting a Storage Object Via Fcoetcm_fc/ create 20:00:00:19:99:a8:34:bc Create an FCoE target with the given WWN. targetcli can tab-complete the WWN based on registered FCoE interfaces. If none are found, verify that they are properly configured and are shown in the output of fcoeadm -i.

If auto_cd_after_create is set to false, change to the configuration node for the given target, equivalent to giving the command prefixed by cd.

luns/ create /backstores/fileio/disk1
Create a new LUN for the interface, attached to a previously defined storage object. The storage object now shows up under the /backstores configuration node as activated.

acls/ create 00:99:88:77:66:55:44:33
Create an ACL (access control list), for defining the resources each initiator may access. The default behavior is to auto-map existing LUNs to the ACL; see help for more information.

The LUN should now be accessible via FCoE.

saveconfig Save the current configuration settings to a file, from which settings will be restored if the system is rebooted. By default, this will save the configuration to

This command is executed from the configuration root node.

Restore target configuration from a file, the default is the file listed under saveconfig. This will fail if there is already an established config, unless the clear_existing option is set to true.

This command is executed from the configuration root node.

Clears the entire current local configuration. The parameter confirm=true must also be given, as a precaution.

This command is executed from the configuration root node.

sessions [ list | detail ] [sid]
Lists the current open sessions or a specific session, with or without details.

This command is executed from the configuration root node.

Leave the configuration shell.

Settings are broken into groups. Individual settings are accessed by get <group> <setting> and set <group> <setting>=<value>, and the settings of an entire group may be displayed by get <group>. All except for auto_ affect shell behavior and may merit customization. Global settings are saved to ~/.attribute /backstore// configuration node. Contains values relating to the backstore and storage object.

/etc/target/* /var/lib/target/*

Written by Jerome Martin . Man page written by Andy Grover .

Report bugs via or

play store download app store download
Sonnenallee 29, 12047 Berlin, Germany

Privacy policy
Successfully copied