systemd.mstack
systemd
systemd.mstack
7
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@id/directory will be turned into a layer of an overlayfs mount. Theididentifier is used to define the order of the layers: a version sort is executed, with the first entry being the bottom layer in theoverlayfsstack, and the last entry becoming the highest layer (precisely: highest "lowerdir") in theoverlayfsstack. -
Similar, a
layer@id.rawregular file will be mounted as a DDI, and the resulting mount will be turned into an overlayfs layer, following the same sorting rules. -
An
rwdirectory will be turned into a writable layer at the very top of theoverlayfsstack. 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@location/directory will be bind mounted to the mount point indicated by thelocationidentifier, in read-write fashion. The location is encoded via the same escaping logic used for naming.mountunits, i.e. slashes become dashes. -
Similar, a
bind@location.rawfile will be mounted as a DDI, and the resulting mount bind mounted to the specified location. -
A
robind@location/is treated very similar tobind@location/, but the resulting bind mount is read-only. -
Similar,
robind@location.rawcreates a read-only bind mount from a DDI. -
If 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.raw -
foobar.mstack/layer@1.raw→../app.raw -
foobar.mstack/rw/
The following .mstack/ consists of a read-only DDI mounted to /usr/ and writable root:
-
waldo.mstack/layer@0.raw→../vendor.raw -
waldo.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.raw -
quux.mstack/bind:var→../myapp1-var/
See Also
systemd(1), systemd-mstack(1), systemd-nspawn(1), systemd.exec(5), systemd.v(7), systemd-vpick(1)
谢谢你的反馈!