xref: /freebsd/usr.sbin/ctld/ctld.8 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1.\" Copyright (c) 2012 The FreeBSD Foundation
2.\"
3.\" This software was developed by Edward Tomasz Napierala under sponsorship
4.\" from the FreeBSD Foundation.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd March 31, 2020
28.Dt CTLD 8
29.Os
30.Sh NAME
31.Nm ctld
32.Nd CAM Target Layer / iSCSI target daemon
33.Sh SYNOPSIS
34.Nm
35.Op Fl d
36.Op Fl f Ar config-file
37.Op Fl u
38.Nm
39.Fl t
40.Op Fl f Ar config-file
41.Op Fl u
42.Sh DESCRIPTION
43The
44.Nm
45daemon is responsible for managing the CAM Target Layer configuration,
46accepting incoming iSCSI connections, performing authentication and
47passing connections to the kernel part of the native iSCSI target.
48.Pp
49Upon startup, the
50.Nm
51daemon parses the configuration file.
52If it encounters any errors,
53.Nm
54exits.
55It then compares the configuration with the kernel list of LUNs managed
56by previously running
57.Nm
58instances, removes LUNs no longer existing in the configuration file,
59and creates new LUNs as necessary.
60After that it listens for the incoming iSCSI connections, performs
61authentication, and, if successful, passes the connections to the kernel part
62of CTL iSCSI target,
63.Xr cfiscsi 4 ,
64which handles it from that point.
65.Pp
66When it receives a SIGHUP signal, the
67.Nm
68reloads its configuration and applies the changes to the kernel.
69Changes are applied in a way that avoids unnecessary disruptions;
70for example removing one LUN does not affect other LUNs.
71.Pp
72When exiting gracefully, the
73.Nm
74daemon removes LUNs it managed and forcibly disconnects all the clients.
75Otherwise - for example, when killed with SIGKILL - LUNs stay configured
76and clients remain connected.
77.Pp
78To perform administrative actions that apply to already connected
79sessions, such as forcing termination, use
80.Xr ctladm 8 .
81.Pp
82The following options are available:
83.Bl -tag -width ".Fl P Ar pidfile"
84.It Fl f Ar config-file
85Specifies the name of the configuration file.
86The default is
87.Pa /etc/ctl.conf .
88.It Fl d
89Debug mode.
90The daemon sends verbose debug output to standard error, and does not
91put itself in the background.
92The daemon will also not fork and will exit after processing one connection.
93This option is only intended for debugging the target.
94.It Fl t
95Test the configuration file for validity and exit.
96.It Fl u
97Use UCL configuration file format instead of the traditional non-UCL format.
98.El
99.Sh FILES
100.Bl -tag -width ".Pa /var/run/ctld.pid" -compact
101.It Pa /etc/ctl.conf
102The configuration file for
103.Nm .
104The file format and configuration options are described in
105.Xr ctl.conf 5 .
106.It Pa /var/run/ctld.pid
107The default location of the
108.Nm
109PID file.
110.El
111.Sh EXIT STATUS
112The
113.Nm
114utility exits 0 on success, and >0 if an error occurs.
115.Sh SEE ALSO
116.Xr cfiscsi 4 ,
117.Xr ctl 4 ,
118.Xr ctl.conf 5 ,
119.Xr ctladm 8 ,
120.Xr ctlstat 8
121.Sh HISTORY
122The
123.Nm
124command appeared in
125.Fx 10.0 .
126.Sh AUTHORS
127The
128.Nm
129was developed by
130.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
131under sponsorship from the FreeBSD Foundation.
132