1targetcli(8) System Manager's Manual targetcli(8)
2
3
4
6 targetcli
7
9 targetcli is a shell for viewing, editing, and saving the configuration
10 of the kernel's target subsystem, also known as LIO. It enables the
11 administrator to assign local storage resources backed by either files,
12 volumes, local SCSI devices, or ramdisk, and export them to remote sys‐
13 tems via network fabrics, such as FCoE.
14
15 The configuration layout is tree-based, similar to a filesystem, and
16 navigated in a similar manner.
17
19 targetcli
20
21 targetcli [cmd]
22
23 Invoke targetcli as root to enter the configuration shell, or follow
24 with a command to execute but do not enter the shell. Use ls to list
25 nodes below the current path. Moving around the tree is accomplished
26 by the cd command, or by entering the new location directly. Objects
27 are created using create, removed using delete. Use help <cmd> for
28 additional usage information. Tab-completion is available for commands
29 and command arguments.
30
31 Configuration changes in targetcli are made immediately to the underly‐
32 ing kernel target configuration. Settings will not be retained across
33 reboot unless saveconfig is either explicitly called, or implicitly by
34 exiting the shell with the global preference auto_save_on_exit set to
35 true, the default.
36
38 To export a storage resource, 1) define a storage object using a back‐
39 store, then 2) export the object via a network fabric, such as FCoE.
40
41 DEFINING A STORAGE OBJECT WITHIN A BACKSTORE
42 backstores/fileio create disk1 /disks/disk1.img 140M
43 Creates a storage object named disk1 with the given path and size.
44 targetcli supports common size abbreviations like 'M', 'G', and 'T'.
45
46 In addition to the fileio backstore for file-backed volumes, other
47 backstore types include block for block-device-backed volumes, and
48 pscsi for volumes backed by local SCSI devices. ramdisk backstore cre‐
49 ates ram-based storage objects. See the built-in help for more details
50 on the required parameters for each backstore type.
51
52 EXPORTING A STORAGE OBJECT VIA FCOE
53 tcm_fc/ create 20:00:00:19:99:a8:34:bc
54 Create an FCoE target with the given WWN. targetcli can tab-complete
55 the WWN based on registered FCoE interfaces. If none are found, verify
56 that they are properly configured and are shown in the output of
57 fcoeadm -i.
58
59 tcm_fc/20:00:00:19:99:a8:34:bc/
60 If auto_cd_after_create is set to false, change to the configuration
61 node for the given target, equivalent to giving the command prefixed by
62 cd.
63
64 luns/ create /backstores/fileio/disk1
65 Create a new LUN for the interface, attached to a previously defined
66 storage object. The storage object now shows up under the /backstores
67 configuration node as activated.
68
69 acls/ create 00:99:88:77:66:55:44:33
70 Create an ACL (access control list), for defining the resources each
71 initiator may access. The default behavior is to auto-map existing LUNs
72 to the ACL; see help for more information.
73
74 The LUN should now be accessible via FCoE.
75
77 saveconfig
78 Save the current configuration settings to a file, from which settings
79 will be restored if the system is rebooted. By default, this will save
80 the configuration to /etc/target/saveconfig.json.
81
82 This command is executed from the configuration root node.
83
84 restoreconfig
85 Restore target configuration from a file, the default is the file
86 listed under saveconfig. This will fail if there is already an estab‐
87 lished config, unless the clear_existing option is set to true.
88
89 This command is executed from the configuration root node.
90
91 clearconfig
92 Clears the entire current local configuration. The parameter con‐
93 firm=true must also be given, as a precaution.
94
95 This command is executed from the configuration root node.
96
97 sessions [ list | detail ] [sid]
98 Lists the current open sessions or a specific session, with or without
99 details.
100
101 This command is executed from the configuration root node.
102
103 exit
104 Leave the configuration shell.
105
107 Settings are broken into groups. Individual settings are accessed by
108 get <group> <setting> and set <group> <setting>=<value>, and the set‐
109 tings of an entire group may be displayed by get <group>. All except
110 for global are associated with a particular configuration node.
111
112 GLOBAL
113 Shell-related user-specific settings are in global, and are visible
114 from all configuration nodes. They are mostly shell display options,
115 but some starting with auto_ affect shell behavior and may merit cus‐
116 tomization. Global settings are saved to ~/.targetcli/ upon exit,
117 unlike other groups.
118
119 BACKSTORE-SPECIFIC
120 attribute
121 /backstore/<type>/<name> configuration node. Contains values relating
122 to the backstore and storage object.
123
125 /etc/target/*
126 /var/lib/target/*
127
129 Written by Jerome Martin <jxm@risingtidesystems.com>.
130 Man page written by Andy Grover <agrover@redhat.com>.
131
133 Report bugs via <target-devel@vger.kernel.org>
134 or <https://github.com/agrover/targetcli-fb/issues>
135
136
137
138 targetcli(8)