Name
systemd.mstack — Mount stacks in self descriptive directories
Description¶
Directories with the ".mstack/" suffix may encode 'mount stacks' for assembling OS
mount hierarchies based on bind and overlay mounts, for use in
systemd-nspawn(1)'s
--mstack= switch or the service manager's RootMStack= setting for
services. ".mstack/" directories may contain various files and subdirectories, where
each will effect one layer of an "overlayfs" mount, or a bind mount. The name of the
file or subdirectory indicates how it shall be used in the mount hierarchy. Specifically, the following
names are defined:
A
layer@directory will be turned into a layer of an overlayfs mount. The "id/id" identifier is used to define the order of the layers: a version sort is executed, with the first entry being the bottom layer in the "overlayfs" stack, and the last entry becoming the highest layer (precisely: highest "lowerdir") in the "overlayfs" stack.Similar, a
layer@regular file will be mounted as a DDI, and the resulting mount will be turned into an overlayfs layer, following the same sorting rules.id.rawAn
rwdirectory will be turned into a writable layer at the very top of the "overlayfs" stack. A subdirectorydataof it will become the "upperdir", a subdirectoryworkwill become the "workdir". Note that these two subdirectories do not need to be created explicitly, they are created automatically on first use should they be missing.A
bind@directory will be bind mounted to the mount point indicated by thelocation/locationidentifier, in read-write fashion. The location is encoded via the same escaping logic used for naming ".mount" units, i.e. slashes become dashes.Similar, a
bind@file will be mounted as a DDI, and the resulting mount bind mounted to the specified location.location.rawA
robind@is treated very similar tolocation/bind@, but the resulting bind mount is read-only.location/Similar,
robind@creates a read-only bind mount from a DDI.location.rawIf a
root/subdirectory exists, it is used as root of the resulting mount hierarchy, and only theusr/subtree of the overlayfs mount will be bound tousr/in the hierarchy.
Note that each of the entry types above may be a symbolic link pointing to a directory or image file, instead a directory or image file itself.
On each listed file or subdirectory type the systemd.v(7) functionality may be used, for automatic selection of versioned resources.
Use the
systemd-mstack(1) tool
to process or mount .mstack/ directories from the command line.
Examples¶
The following .mstack/ consists of two read-only overlayfs layers as DDI, plus one
writable directory on top. The read-only layers are symlinked:
foobar.mstack/layer@0.raw→../base.rawfoobar.mstack/layer@1.raw→../app.rawfoobar.mstack/rw/
The following .mstack/ consists of a read-only DDI mounted to "/usr/"
and writable root:
waldo.mstack/layer@0.raw→../vendor.rawwaldo.mstack/root/
The following .mstack/ consists of a read-only DDI mounted as root, but a
writable /var/ mounted on top:
quux.mstack/layer@0.raw→../myapp1.rawquux.mstack/bind:var→../myapp1-var/