Debian Codegraph @

man/storagectl.xml

raw
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="storagectl"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>storagectl</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>storagectl</refentrytitle>
16 <manvolnum>1</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>storagectl</refname>
21 <refname>mount.storage</refname>
22 <refpurpose>Enumerate and mount storage volumes provided by storage providers</refpurpose>
23 </refnamediv>
24
25 <refsynopsisdiv>
26 <cmdsynopsis>
27 <command>storagectl</command>
28 <arg choice="opt" rep="repeat">OPTIONS</arg>
29 <arg choice="req">COMMAND</arg>
30 <arg choice="opt" rep="repeat">NAME</arg>
31 </cmdsynopsis>
32
33 <cmdsynopsis>
34 <command>mount</command>
35 <arg choice="plain">-t</arg>
36 <arg choice="plain">storage</arg>
37 <arg choice="plain"><replaceable>PROVIDER</replaceable>:<replaceable>VOLUME</replaceable></arg>
38 <arg choice="plain"><replaceable>DIRECTORY</replaceable></arg>
39 </cmdsynopsis>
40
41 <cmdsynopsis>
42 <command>mount</command>
43 <arg choice="plain">-t</arg>
44 <arg choice="plain">storage.<replaceable>FSTYPE</replaceable></arg>
45 <arg choice="plain"><replaceable>PROVIDER</replaceable>:<replaceable>VOLUME</replaceable></arg>
46 <arg choice="plain"><replaceable>DIRECTORY</replaceable></arg>
47 </cmdsynopsis>
48 </refsynopsisdiv>
49
50 <refsect1>
51 <title>Description</title>
52
53 <para><command>storagectl</command> may be used to inspect storage providers and the storage
54 volumes they expose. A storage provider is a service implementing the
55 <constant>io.systemd.StorageProvider</constant> <ulink url="https://varlink.org/">Varlink</ulink>
56 interface, registered as an AF_UNIX socket below the well-known socket directory
57 <filename>/run/systemd/io.systemd.StorageProvider/</filename> (in system mode) or
58 <varname>$XDG_RUNTIME_DIR</varname><filename>/systemd/io.systemd.StorageProvider/</filename> (in user mode). The two
59 storage providers shipped with systemd are
60 <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
61 which exposes the system's block devices, and
62 <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
63 which exposes regular files and directories from a backing file system.</para>
64
65 <para>The tool also provides a <citerefentry
66 project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry> helper
67 for the file system type <literal>storage</literal>, which permits mounting storage volumes to arbitrary
68 places. See "Use as a mount helper" below for details.</para>
69 </refsect1>
70
71 <refsect1>
72 <title>Commands</title>
73
74 <para>The following commands are understood:</para>
75
76 <variablelist>
77
78 <varlistentry>
79 <term><command>volumes</command> <optional><replaceable>GLOB</replaceable></optional></term>
80
81 <listitem><para>List storage volumes provided by all storage providers running on the
82 system (or, with <option>--user</option>, in the user runtime). The optional
83 <replaceable>GLOB</replaceable> argument is a shell-style pattern (see
84 <citerefentry project='man-pages'><refentrytitle>fnmatch</refentrytitle><manvolnum>3</manvolnum></citerefentry>)
85 that filters the result by volume name. The output is a table containing the providing
86 service, the volume name, its type (<literal>blk</literal>, <literal>reg</literal> or
87 <literal>dir</literal>), whether it is read-only, and — if known — its size and the number
88 of bytes used.</para>
89
90 <para>This is the default command if none is specified.</para>
91
92 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
93 </varlistentry>
94
95 <varlistentry>
96 <term><command>templates</command> <optional><replaceable>GLOB</replaceable></optional></term>
97
98 <listitem><para>List volume templates supported by the running storage providers. Templates
99 encapsulate a configuration to use when creating volumes on-the-fly, when they are acquired. Template
100 support is an optional feature for providers, and only applies to providers that allow creation
101 of volumes on-the-fly. See the respective provider documentation for details, for example
102 <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry>. The
103 optional <replaceable>GLOB</replaceable> argument filters by template name. Storage providers that do
104 not implement template-based volume creation (such as the block-device provider) do not contribute to
105 this output.</para>
106
107 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
108 </varlistentry>
109
110 <varlistentry>
111 <term><command>providers</command></term>
112
113 <listitem><para>List the storage providers known to the system. This is determined by scanning the
114 well-known socket directory for <constant>AF_UNIX</constant> sockets that look like
115 <constant>io.systemd.StorageProvider</constant> endpoints. For each provider it is also reported
116 whether the socket can currently be connected to.</para>
117
118 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
119 </varlistentry>
120 </variablelist>
121 </refsect1>
122
123 <refsect1>
124 <title>Options</title>
125
126 <para>The following options are understood:</para>
127
128 <variablelist>
129 <varlistentry>
130 <term><option>--system</option></term>
131
132 <listitem><para>Operate on system-wide storage providers. Sockets are looked for in
133 <filename>/run/systemd/io.systemd.StorageProvider/</filename>. This is the default.</para>
134
135 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
136 </varlistentry>
137
138 <varlistentry>
139 <term><option>--user</option></term>
140
141 <listitem><para>Operate on per-user storage providers. Sockets are looked for in
142 <filename>$XDG_RUNTIME_DIR/systemd/io.systemd.StorageProvider/</filename>.</para>
143
144 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
145 </varlistentry>
146
147 <xi:include href="standard-options.xml" xpointer="json" />
148 <xi:include href="standard-options.xml" xpointer="no-pager" />
149 <xi:include href="standard-options.xml" xpointer="no-legend" />
150 <xi:include href="standard-options.xml" xpointer="no-ask-password" />
151 <xi:include href="standard-options.xml" xpointer="help" />
152 <xi:include href="standard-options.xml" xpointer="version" />
153 </variablelist>
154 </refsect1>
155
156 <refsect1>
157 <title>Use as a mount helper</title>
158
159 <para>The tool provides the <command>/sbin/mount.storage</command> alias, implementing the
160 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
161 "external helper" interface, allowing storage volumes to be mounted with the regular
162 <command>mount</command> command. The volume to mount is encoded as the source of the mount,
163 in the form
164 <literal><replaceable>PROVIDER</replaceable>:<replaceable>VOLUME</replaceable></literal>, where
165 <replaceable>PROVIDER</replaceable> is the name of a storage provider (as listed by
166 <command>storagectl providers</command>) and <replaceable>VOLUME</replaceable> is the volume
167 name. Two file system type spellings are recognized:</para>
168
169 <variablelist>
170 <varlistentry>
171 <term><literal>storage</literal></term>
172
173 <listitem><para>Acquires a directory volume and bind-mounts its directory tree onto the
174 target.</para>
175
176 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
177 </varlistentry>
178
179 <varlistentry>
180 <term><literal>storage.<replaceable>FSTYPE</replaceable></literal></term>
181
182 <listitem><para>Acquires a regular file or block device volume and mounts it as a file system of type
183 <replaceable>FSTYPE</replaceable> (for example <literal>storage.ext4</literal>,
184 <literal>storage.btrfs</literal>, …).</para>
185
186 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
187 </varlistentry>
188 </variablelist>
189
190 <para>The standard <option>-o</option> mount options are forwarded to
191 <command>mount</command>. In addition, the following <literal>storage.</literal>-prefixed
192 options are interpreted by <command>mount.storage</command> itself and stripped from the
193 forwarded list:</para>
194
195 <variablelist>
196 <varlistentry>
197 <term><option>storage.create=</option><replaceable>MODE</replaceable></term>
198
199 <listitem><para>Takes one of <literal>any</literal> (open if it exists, otherwise create — the
200 default), <literal>open</literal> (fail if the volume does not yet exist) or <literal>new</literal>
201 (fail if the volume already exists).</para>
202
203 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
204 </varlistentry>
205
206 <varlistentry>
207 <term><option>storage.template=</option><replaceable>NAME</replaceable></term>
208
209 <listitem><para>The template to use when creating a new volume, if it is missing and the provider
210 supports on-the-fly creation of volumes.</para>
211
212 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
213 </varlistentry>
214
215 <varlistentry>
216 <term><option>storage.create-size=</option><replaceable>BYTES</replaceable></term>
217
218 <listitem><para>When creating a new volume on-the-fly, the size in bytes to allocate. Accepts the
219 usual <literal>K</literal>/<literal>M</literal>/<literal>G</literal>/<literal>T</literal> suffixes
220 (base 1024). Required when creating a regular file volume.</para>
221
222 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
223 </varlistentry>
224 </variablelist>
225
226 </refsect1>
227
228 <refsect1>
229 <title>Examples</title>
230
231 <example>
232 <title>Enumerate available storage providers, volumes and templates</title>
233
234 <programlisting>$ storagectl providers
235 $ storagectl volumes
236 $ storagectl volumes '*foo*'
237 $ storagectl templates</programlisting>
238 </example>
239
240 <example>
241 <title>Mount a directory volume from the file system provider</title>
242
243 <programlisting># mount -t storage fs:myvol /mnt/myvol</programlisting>
244
245 <para>If the volume <literal>myvol</literal> does not yet exist, it will be created using
246 the default <literal>subvolume</literal> template.</para>
247 </example>
248
249 <example>
250 <title>Create and mount an ext4 file system from a regular file.</title>
251
252 <programlisting># mount -t storage.ext4 fs:scratch /mnt/scratch -o loop</programlisting>
253 </example>
254
255 <example>
256 <title>Mount a block device volume read-only</title>
257
258 <programlisting># mount -t storage.ext4 -o ro block:/dev/disk/by-id/usb-foo /mnt/foo</programlisting>
259 </example>
260 </refsect1>
261
262 <refsect1>
263 <title>Exit status</title>
264
265 <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
266 </refsect1>
267
268 <xi:include href="common-variables.xml" />
269
270 <refsect1>
271 <title>See Also</title>
272 <para><simplelist type="inline">
273 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
274 <member><citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
275 <member><citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
276 <member><citerefentry><refentrytitle>varlinkctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
277 <member><citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
278 </simplelist></para>
279 </refsect1>
280
281 </refentry>