| 1 |
<?xml version='1.0'?> <!--*-nxml-*--> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="systemd.mstack"> |
| 7 |
|
| 8 |
<refentryinfo> |
| 9 |
<title>systemd.mstack</title> |
| 10 |
<productname>systemd</productname> |
| 11 |
</refentryinfo> |
| 12 |
|
| 13 |
<refmeta> |
| 14 |
<refentrytitle>systemd.mstack</refentrytitle> |
| 15 |
<manvolnum>7</manvolnum> |
| 16 |
</refmeta> |
| 17 |
|
| 18 |
<refnamediv> |
| 19 |
<refname>systemd.mstack</refname> |
| 20 |
<refpurpose>Mount stacks in self descriptive directories</refpurpose> |
| 21 |
</refnamediv> |
| 22 |
|
| 23 |
<refsect1> |
| 24 |
<title>Description</title> |
| 25 |
|
| 26 |
<para>Directories with the <literal>.mstack/</literal> suffix may encode 'mount stacks' for assembling OS |
| 27 |
mount hierarchies based on bind and overlay mounts, for use in |
| 28 |
<citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s |
| 29 |
<option>--mstack=</option> switch or the service manager's <option>RootMStack=</option> setting for |
| 30 |
services. <literal>.mstack/</literal> directories may contain various files and subdirectories, where |
| 31 |
each will effect one layer of an <literal>overlayfs</literal> mount, or a bind mount. The name of the |
| 32 |
file or subdirectory indicates how it shall used in the mount hierarchy. Specifically, the following |
| 33 |
names are defined:</para> |
| 34 |
|
| 35 |
<orderedlist> |
| 36 |
<listitem><para>A <filename>layer@<replaceable>id</replaceable>/</filename> directory will be turned into |
| 37 |
a layer of an overlayfs mount. The <literal>id</literal> identifier is used to define the order of the |
| 38 |
layers: a version sort is executed, with the first entry being the bottom layer in the |
| 39 |
<literal>overlayfs</literal> stack, and the last entry becoming the highest layer (precisely: |
| 40 |
highest "lowerdir") in the <literal>overlayfs</literal> stack.</para></listitem> |
| 41 |
|
| 42 |
<listitem><para>Similar, a <filename>layer@<replaceable>id</replaceable>.raw</filename> regular file |
| 43 |
will be mounted as a DDI, and the resulting mount will be turned into an overlayfs layer, following the |
| 44 |
same sorting rules.</para></listitem> |
| 45 |
|
| 46 |
<listitem><para>An <filename>rw</filename> directory will be turned into a writable layer at the very top |
| 47 |
of the <literal>overlayfs</literal> stack. A subdirectory <filename>data</filename> of it will become |
| 48 |
the "upperdir", a subdirectory <filename>work</filename> will become the "workdir". Note that these two |
| 49 |
subdirectories do not need to be created explicitly, they are created automatically on first use should |
| 50 |
they be missing.</para></listitem> |
| 51 |
|
| 52 |
<listitem><para>A <filename>bind@<replaceable>location</replaceable>/</filename> directory will be bind |
| 53 |
mounted to the mount point indicated by the <varname>location</varname> identifier, in read-write |
| 54 |
fashion. The location is encoded via the same escaping logic used for naming <literal>.mount</literal> |
| 55 |
units, i.e. slashes become dashes.</para></listitem> |
| 56 |
|
| 57 |
<listitem><para>Similar, a |
| 58 |
<filename>bind@<replaceable>location</replaceable>.raw</filename> file will be mounted as a DDI, and the |
| 59 |
resulting mount bind mounted to the specified location.</para></listitem> |
| 60 |
|
| 61 |
<listitem><para>A <filename>robind@<replaceable>location</replaceable>/</filename> is treated very |
| 62 |
similar to <filename>bind@<replaceable>location</replaceable>/</filename>, but the resulting bind mount |
| 63 |
is read-only.</para></listitem> |
| 64 |
|
| 65 |
<listitem><para>Similar, <filename>robind@<replaceable>location</replaceable>.raw</filename> creates a |
| 66 |
read-only bind mount from a DDI.</para></listitem> |
| 67 |
|
| 68 |
<listitem><para>If a <filename>root/</filename> subdirectory it is used as root of the resulting mount |
| 69 |
hierarchy, and only the <filename>usr/</filename> subtree of the overlayfs mount will be bound to |
| 70 |
<filename>usr/</filename> in the hierarchy.</para></listitem> |
| 71 |
</orderedlist> |
| 72 |
|
| 73 |
<para>Note that each of the entry types above may be a symbolic link pointing to a directory or image |
| 74 |
file, instead a directory or image file itself.</para> |
| 75 |
|
| 76 |
<para>On each listed file or subdirectory type the |
| 77 |
<citerefentry><refentrytitle>systemd.v</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
| 78 |
functionality may be used, for automatic selection of versioned resources.</para> |
| 79 |
|
| 80 |
<para>Use the |
| 81 |
<citerefentry><refentrytitle>systemd-mstack</refentrytitle><manvolnum>1</manvolnum></citerefentry> tool |
| 82 |
to process or mount <filename>.mstack/</filename> directories from the command line.</para> |
| 83 |
</refsect1> |
| 84 |
|
| 85 |
<refsect1> |
| 86 |
<title>Examples</title> |
| 87 |
|
| 88 |
<para>The following <filename>.mstack/</filename> consists of two read-only overlayfs layers as DDI, plus one |
| 89 |
writable directory one on top. The read-only layers are symlinked:</para> |
| 90 |
|
| 91 |
<orderedlist> |
| 92 |
<listitem><para><filename>foobar.mstack/[email protected]</filename> → <filename>../base.raw</filename></para></listitem> |
| 93 |
<listitem><para><filename>foobar.mstack/[email protected]</filename> → <filename>../app.raw</filename></para></listitem> |
| 94 |
<listitem><para><filename>foobar.mstack/rw/</filename></para></listitem> |
| 95 |
</orderedlist> |
| 96 |
|
| 97 |
<para>The following <filename>.mstack/</filename> consists of a read-only DDI mounted to <literal>/usr/</literal> |
| 98 |
and writable root:</para> |
| 99 |
|
| 100 |
<orderedlist> |
| 101 |
<listitem><para><filename>waldo.mstack/[email protected]</filename> → <filename>../vendor.raw</filename></para></listitem> |
| 102 |
<listitem><para><filename>waldo.mstack/root/</filename></para></listitem> |
| 103 |
</orderedlist> |
| 104 |
|
| 105 |
<para>The following <filename>.mstack/</filename> consists of a read-only DDI mounted as root, but a |
| 106 |
writable <filename>/var/</filename> mounted on top:</para> |
| 107 |
|
| 108 |
<orderedlist> |
| 109 |
<listitem><para><filename>quux.mstack/[email protected]</filename> → <filename>../myapp1.raw</filename></para></listitem> |
| 110 |
<listitem><para><filename>quux.mstack/bind:var</filename> → <filename>../myapp1-var/</filename></para></listitem> |
| 111 |
</orderedlist> |
| 112 |
</refsect1> |
| 113 |
|
| 114 |
<refsect1> |
| 115 |
<title>See Also</title> |
| 116 |
<para><simplelist type="inline"> |
| 117 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 118 |
<member><citerefentry><refentrytitle>systemd-mstack</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 119 |
<member><citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 120 |
<member><citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 121 |
<member><citerefentry><refentrytitle>systemd.v</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 122 |
<member><citerefentry><refentrytitle>systemd-vpick</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 123 |
</simplelist></para> |
| 124 |
</refsect1> |
| 125 |
|
| 126 |
</refentry> |