2020-07-29 16:43:43 +03:00
<?xml version='1.0'?> <!-- * - nxml - * -->
< !DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
2023-12-25 17:48:33 +03:00
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
2020-11-09 07:23:58 +03:00
<!-- SPDX - License - Identifier: LGPL - 2.1 - or - later -->
2020-07-29 16:43:43 +03:00
2020-08-20 18:41:19 +03:00
<refentry id= "systemd-dissect" conditional= 'HAVE_BLKID'
2020-07-29 16:43:43 +03:00
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo >
<title > systemd-dissect</title>
<productname > systemd</productname>
</refentryinfo>
<refmeta >
<refentrytitle > systemd-dissect</refentrytitle>
<manvolnum > 1</manvolnum>
</refmeta>
<refnamediv >
<refname > systemd-dissect</refname>
2023-03-06 20:48:18 +03:00
<refname > mount.ddi</refname>
2022-10-25 19:59:10 +03:00
<refpurpose > Dissect Discoverable Disk Images (DDIs)</refpurpose>
2020-07-29 16:43:43 +03:00
</refnamediv>
<refsynopsisdiv >
<cmdsynopsis >
2023-12-25 17:42:34 +03:00
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg choice= "plain" > <replaceable > IMAGE</replaceable> </arg>
2020-07-29 16:43:43 +03:00
</cmdsynopsis>
<cmdsynopsis >
2023-12-25 18:38:08 +03:00
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg > --mount</arg> <arg choice= "plain" > <replaceable > IMAGE</replaceable> </arg> <arg choice= "plain" > <replaceable > PATH</replaceable> </arg>
2020-07-29 16:43:43 +03:00
</cmdsynopsis>
2022-07-28 02:55:11 +03:00
<cmdsynopsis >
2023-12-25 18:38:08 +03:00
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg > --umount</arg> <arg choice= "plain" > <replaceable > PATH</replaceable> </arg>
2022-07-28 02:55:11 +03:00
</cmdsynopsis>
2023-03-06 13:59:16 +03:00
<cmdsynopsis >
2023-12-25 18:38:08 +03:00
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg > --attach</arg> <arg choice= "plain" > <replaceable > IMAGE</replaceable> </arg>
2023-03-06 13:59:16 +03:00
</cmdsynopsis>
<cmdsynopsis >
2023-12-25 18:38:08 +03:00
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg > --detach</arg> <arg choice= "plain" > <replaceable > PATH</replaceable> </arg>
2023-03-06 13:59:16 +03:00
</cmdsynopsis>
2022-10-20 09:07:37 +03:00
<cmdsynopsis >
2023-12-25 18:38:08 +03:00
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg > --list</arg> <arg choice= "plain" > <replaceable > IMAGE</replaceable> </arg>
2022-10-20 09:07:37 +03:00
</cmdsynopsis>
2022-11-09 14:12:02 +03:00
<cmdsynopsis >
2023-12-25 18:38:08 +03:00
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg > --mtree</arg> <arg choice= "plain" > <replaceable > IMAGE</replaceable> </arg>
2022-11-09 14:12:02 +03:00
</cmdsynopsis>
2022-11-08 19:36:46 +03:00
<cmdsynopsis >
2023-12-25 18:38:08 +03:00
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg > --with</arg> <arg choice= "plain" > <replaceable > IMAGE</replaceable> </arg> <arg choice= "opt" rep= "repeat" > <replaceable > COMMAND</replaceable> </arg>
2022-11-08 19:36:46 +03:00
</cmdsynopsis>
2020-07-29 16:43:43 +03:00
<cmdsynopsis >
2023-12-25 18:38:08 +03:00
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg > --copy-from</arg> <arg choice= "plain" > <replaceable > IMAGE</replaceable> </arg> <arg choice= "plain" > <replaceable > PATH</replaceable> </arg> <arg choice= "opt" > <replaceable > TARGET</replaceable> </arg>
2020-07-29 16:43:43 +03:00
</cmdsynopsis>
<cmdsynopsis >
2023-12-25 18:38:08 +03:00
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg > --copy-to</arg> <arg choice= "plain" > <replaceable > IMAGE</replaceable> </arg> <arg choice= "opt" > <replaceable > SOURCE</replaceable> </arg> <arg choice= "plain" > <replaceable > PATH</replaceable> </arg>
2020-07-29 16:43:43 +03:00
</cmdsynopsis>
2024-01-24 14:28:41 +03:00
<cmdsynopsis >
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg > --make-archive</arg> <arg choice= "plain" > <replaceable > IMAGE</replaceable> </arg> <arg choice= "opt" > <replaceable > TARGET</replaceable> </arg>
</cmdsynopsis>
2023-09-25 17:16:41 +03:00
<cmdsynopsis >
2023-12-25 18:38:08 +03:00
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg > --discover</arg>
2023-09-25 17:16:41 +03:00
</cmdsynopsis>
<cmdsynopsis >
2023-12-25 18:38:08 +03:00
<command > systemd-dissect</command> <arg choice= "opt" rep= "repeat" > OPTIONS</arg> <arg > --validate</arg> <arg choice= "plain" > <replaceable > IMAGE</replaceable> </arg>
2023-09-25 17:16:41 +03:00
</cmdsynopsis>
2020-07-29 16:43:43 +03:00
</refsynopsisdiv>
<refsect1 >
<title > Description</title>
<para > <command > systemd-dissect</command> is a tool for introspecting and interacting with file system OS
2022-11-11 22:42:49 +03:00
disk images, specifically Discoverable Disk Images (DDIs). It supports four different operations:</para>
2020-07-29 16:43:43 +03:00
<orderedlist >
<listitem > <para > Show general OS image information, including the image's
<citerefentry > <refentrytitle > os-release</refentrytitle> <manvolnum > 5</manvolnum> </citerefentry> data,
machine ID, partition information and more.</para> </listitem>
<listitem > <para > Mount an OS image to a local directory. In this mode it will dissect the OS image and
mount the included partitions according to their designation onto a directory and possibly
sub-directories.</para> </listitem>
2022-07-28 02:55:11 +03:00
<listitem > <para > Unmount an OS image from a local directory. In this mode it will recursively unmount
the mounted partitions and remove the underlying loop device, including all the partition sub-devices.
</para> </listitem>
2020-07-29 16:43:43 +03:00
<listitem > <para > Copy files and directories in and out of an OS image.</para> </listitem>
</orderedlist>
<para > The tool may operate on three types of OS images:</para>
<orderedlist >
<listitem > <para > OS disk images containing a GPT partition table envelope, with partitions marked
2022-11-14 11:44:39 +03:00
according to the <ulink url= "https://uapi-group.org/specifications/specs/discoverable_partitions_specification" > Discoverable Partitions
2020-07-29 16:43:43 +03:00
Specification</ulink> .</para> </listitem>
<listitem > <para > OS disk images containing just a plain file-system without an enveloping partition
table. (This file system is assumed to be the root file system of the OS.)</para> </listitem>
<listitem > <para > OS disk images containing a GPT or MBR partition table, with a single
partition only. (This partition is assumed to contain the root file system of the OS.)</para> </listitem>
</orderedlist>
<para > OS images may use any kind of Linux-supported file systems. In addition they may make use of LUKS
disk encryption, and contain Verity integrity information. Note that qualifying OS images may be booted
2020-09-30 15:57:21 +03:00
with <citerefentry > <refentrytitle > systemd-nspawn</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> 's
2020-07-29 16:43:43 +03:00
<option > --image=</option> switch, and be used as root file system for system service using the
<varname > RootImage=</varname> unit file setting, see
2020-09-30 15:57:21 +03:00
<citerefentry > <refentrytitle > systemd.exec</refentrytitle> <manvolnum > 5</manvolnum> </citerefentry> .</para>
2020-09-17 19:00:26 +03:00
<para > Note that the partition table shown when invoked without command switch (as listed below) does not
necessarily show all partitions included in the image, but just the partitions that are understood and
considered part of an OS disk image. Specifically, partitions of unknown types are ignored, as well as
duplicate partitions (i.e. more than one per partition type), as are root and <filename > /usr/</filename>
partitions of architectures not compatible with the local system. In other words: this tool will display
what it operates with when mounting the image. To display the complete list of partitions use a tool such
as <citerefentry
project='man-pages'><refentrytitle > fdisk</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> .</para>
2023-03-06 20:48:18 +03:00
<para > The <command > systemd-dissect</command> command may be invoked as <command > mount.ddi</command> in
which case it implements the <citerefentry
project='man-pages'><refentrytitle > mount</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> "external
helper" interface. This ensures disk images compatible with <command > systemd-dissect</command> can be
mounted directly by <command > mount</command> and <citerefentry
project='man-pages'><refentrytitle > fstab</refentrytitle> <manvolnum > 5</manvolnum> </citerefentry> . For
details see below.</para>
2023-11-16 13:31:02 +03:00
2024-02-17 00:45:01 +03:00
<xi:include href= "vpick.xml" xpointer= "image" />
2020-07-29 16:43:43 +03:00
</refsect1>
<refsect1 >
<title > Commands</title>
<para > If neither of the command switches listed below are passed the specified disk image is opened and
general information about the image and the contained partitions and their use is shown.</para>
<variablelist >
<varlistentry >
<term > <option > --mount</option> </term>
<term > <option > -m</option> </term>
<listitem > <para > Mount the specified OS image to the specified directory. This will dissect the image,
determine the OS root file system — as well as possibly other partitions — and mount them to the
specified directory. If the OS image contains multiple partitions marked with the <ulink
2022-11-14 11:44:39 +03:00
url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable Partitions Specification</ulink>
2020-07-29 16:43:43 +03:00
multiple nested mounts are established. This command expects two arguments: a path to an image file
and a path to a directory where to mount the image.</para>
2022-07-28 02:55:11 +03:00
<para > To unmount an OS image mounted like this use the <option > --umount</option> operation.</para>
2020-07-29 16:43:43 +03:00
<para > When the OS image contains LUKS encrypted or Verity integrity protected file systems
appropriate volumes are automatically set up and marked for automatic disassembly when the image is
unmounted.</para>
<para > The OS image may either be specified as path to an OS image stored in a regular file or may
refer to block device node (in the latter case the block device must be the "whole" device, i.e. not
a partition device). (The other supported commands described here support this, too.)</para>
<para > All mounted file systems are checked with the appropriate <citerefentry
project='man-pages'><refentrytitle > fsck</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry>
implementation in automatic fixing mode, unless explicitly turned off (<option > --fsck=no</option> ) or
2023-03-06 20:48:18 +03:00
read-only operation is requested (<option > --read-only</option> ).</para>
<para > Note that this functionality is also available in <citerefentry
project='man-pages'><refentrytitle > mount</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> via a
command such as <command > mount -t ddi myimage.raw targetdir/</command> , as well as in <citerefentry
project='man-pages'><refentrytitle > fstab</refentrytitle> <manvolnum > 5</manvolnum> </citerefentry> . For
2023-08-22 19:52:36 +03:00
details, see below.</para>
<xi:include href= "version-info.xml" xpointer= "v247" /> </listitem>
2020-07-29 16:43:43 +03:00
</varlistentry>
<varlistentry >
<term > <option > -M</option> </term>
2023-08-22 19:52:36 +03:00
<listitem > <para > This is a shortcut for <option > --mount --mkdir</option> .</para>
<xi:include href= "version-info.xml" xpointer= "v247" /> </listitem>
2020-07-29 16:43:43 +03:00
</varlistentry>
2022-07-28 02:55:11 +03:00
<varlistentry >
<term > <option > --umount</option> </term>
<term > <option > -u</option> </term>
<listitem > <para > Unmount an OS image from the specified directory. This command expects one argument:
a directory where an OS image was mounted.</para>
<para > All mounted partitions will be recursively unmounted, and the underlying loop device will be
2023-08-22 19:52:36 +03:00
removed, along with all its partition sub-devices.</para>
<xi:include href= "version-info.xml" xpointer= "v252" /> </listitem>
2022-07-28 02:55:11 +03:00
</varlistentry>
<varlistentry >
<term > <option > -U</option> </term>
2023-08-22 19:52:36 +03:00
<listitem > <para > This is a shortcut for <option > --umount --rmdir</option> .</para>
<xi:include href= "version-info.xml" xpointer= "v252" /> </listitem>
2022-07-28 02:55:11 +03:00
</varlistentry>
2023-03-06 13:59:16 +03:00
<varlistentry >
<term > <option > --attach</option> </term>
<listitem > <para > Attach the specified disk image to an automatically allocated loopback block device,
and print the path to the loopback block device to standard output. This is similar to an invocation
of <command > losetup --find --show</command> , but will validate the image as DDI before attaching, and
derive the correct sector size to use automatically. Moreover, it ensures the per-partition block
2023-08-22 19:52:36 +03:00
devices are created before returning. Takes a path to a disk image file.</para>
<xi:include href= "version-info.xml" xpointer= "v254" /> </listitem>
2023-03-06 13:59:16 +03:00
</varlistentry>
<varlistentry >
<term > <option > --detach</option> </term>
<listitem > <para > Detach the specified disk image from a loopback block device. This undoes the effect
of <option > --attach</option> above. This expects either a path to a loopback block device as an
argument, or the path to the backing image file. In the latter case it will automatically determine
2023-08-22 19:52:36 +03:00
the right device to detach.</para>
<xi:include href= "version-info.xml" xpointer= "v254" /> </listitem>
2023-03-06 13:59:16 +03:00
</varlistentry>
2022-07-28 02:55:11 +03:00
2022-10-20 09:07:37 +03:00
<varlistentry >
<term > <option > --list</option> </term>
<term > <option > -l</option> </term>
2023-07-06 11:58:44 +03:00
<listitem > <para > Prints the paths of all the files and directories in the specified OS image or
2023-08-22 19:52:36 +03:00
directory to standard output.</para>
<xi:include href= "version-info.xml" xpointer= "v253" /> </listitem>
2022-10-20 09:07:37 +03:00
</varlistentry>
2022-11-09 14:12:02 +03:00
<varlistentry >
<term > <option > --mtree</option> </term>
2023-05-17 13:24:04 +03:00
<listitem > <para > Generates a BSD
<citerefentry project= 'die-net' > <refentrytitle > mtree</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry>
2023-07-06 11:58:44 +03:00
compatible file manifest of the specified disk image or directory. This is useful for comparing image
2022-11-09 14:12:02 +03:00
contents in detail, including inode information and other metadata. While the generated manifest will
contain detailed inode information, it currently excludes extended attributes, file system
2023-05-17 13:24:04 +03:00
capabilities, MAC labels,
<citerefentry project= 'man-pages' > <refentrytitle > chattr</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry>
file flags,
2023-11-07 20:14:33 +03:00
<citerefentry project= 'url' > <refentrytitle url= 'https://btrfs.readthedocs.io/en/latest/btrfs-man5.html' > btrfs</refentrytitle> <manvolnum > 5</manvolnum> </citerefentry>
2023-05-17 13:24:04 +03:00
subvolume information, and various other file metadata. File content information is shown via a
SHA256 digest. Additional fields might be added in future. Note that inode information such as link
counts, inode numbers and timestamps is excluded from the output on purpose, as it typically
2023-08-22 19:52:36 +03:00
complicates reproducibility.</para>
<xi:include href= "version-info.xml" xpointer= "v253" /> </listitem>
2022-11-09 14:12:02 +03:00
</varlistentry>
2022-11-08 19:36:46 +03:00
<varlistentry >
<term > <option > --with</option> </term>
<listitem > <para > Runs the specified command with the specified OS image mounted. This will mount the
image to a temporary directory, switch the current working directory to it, and invoke the specified
command line as child process. Once the process ends it will unmount the image again, and remove the
temporary directory. If no command is specified a shell is invoked. The image is mounted writable,
use <option > --read-only</option> to switch to read-only operation. The invoked process will have the
<varname > $SYSTEMD_DISSECT_ROOT</varname> environment variable set, containing the absolute path name
of the temporary mount point, i.e. the same directory that is set as the current working
2023-08-17 16:07:57 +03:00
directory. It will also have the <varname > $SYSTEMD_DISSECT_DEVICE</varname> environment variable set,
2023-08-22 19:52:36 +03:00
containing the absolute path name of the loop device the image was attached to.</para>
<xi:include href= "version-info.xml" xpointer= "v253" /> </listitem>
2022-11-08 19:36:46 +03:00
</varlistentry>
2020-07-29 16:43:43 +03:00
<varlistentry >
<term > <option > --copy-from</option> </term>
<term > <option > -x</option> </term>
2023-07-06 11:58:44 +03:00
<listitem > <para > Copies a file or directory from the specified OS image or directory into the
specified location on the host file system. Expects three arguments: a path to an image file or
directory, a source path (relative to the image's root directory) and a destination path (relative to
the current working directory, or an absolute path, both outside of the image). If the destination
path is omitted or specified as dash (<literal > -</literal> ), the specified file is written to
standard output. If the source path in the image file system refers to a regular file it is copied to
the destination path. In this case access mode, extended attributes and timestamps are copied as
well, but file ownership is not. If the source path in the image refers to a directory, it is copied
to the destination path, recursively with all containing files and directories. In this case the file
2023-08-22 19:52:36 +03:00
ownership is copied too.</para>
<xi:include href= "version-info.xml" xpointer= "v247" /> </listitem>
2020-07-29 16:43:43 +03:00
</varlistentry>
<varlistentry >
<term > <option > --copy-to</option> </term>
<term > <option > -a</option> </term>
<listitem > <para > Copies a file or directory from the specified location in the host file system into
2023-07-06 11:58:44 +03:00
the specified OS image or directory. Expects three arguments: a path to an image file or directory, a
source path (relative to the current working directory, or an absolute path, both outside of the
image) and a destination path (relative to the image's root directory). If the source path is omitted
or specified as dash (<literal > -</literal> ), the data to write is read from standard input. If the
source path in the host file system refers to a regular file, it is copied to the destination path.
In this case access mode, extended attributes and timestamps are copied as well, but file ownership
is not. If the source path in the host file system refers to a directory it is copied to the
destination path, recursively with all containing files and directories. In this case the file
ownership is copied too.</para>
2020-07-29 16:43:43 +03:00
<para > As with <option > --mount</option> file system checks are implicitly run before the copy
2023-08-22 19:52:36 +03:00
operation begins.</para>
<xi:include href= "version-info.xml" xpointer= "v247" /> </listitem>
2020-07-29 16:43:43 +03:00
</varlistentry>
2024-01-24 14:28:41 +03:00
<varlistentry >
<term > <option > --make-archive</option> </term>
<listitem > <para > Generates an archive file from the specified disk image. Expects two arguments: the
path to the disk image and optionally the output archive file path. If the latter is omitted the
archive is written to standard output. The archive file format is determined automatically from the
specified output archive file name, e.g. any path suffixed with <literal > .tar.xz</literal> will
result in an xz compressed UNIX tarball (if the path is omitted an uncompressed UNIX tarball is
created). See
<citerefentry > <refentrytitle > libarchive</refentrytitle> <manvolnum > 3</manvolnum> </citerefentry> for a
list of supported archive formats and compression schemes.</para>
<xi:include href= "version-info.xml" xpointer= "v256" /> </listitem>
</varlistentry>
2022-11-29 18:39:06 +03:00
<varlistentry >
<term > <option > --discover</option> </term>
2022-12-13 22:24:08 +03:00
<listitem > <para > Show a list of DDIs in well-known directories. This will show machine, portable
2023-04-06 11:30:34 +03:00
service and system/configuration extension disk images in the usual directories
2022-11-29 18:39:06 +03:00
<filename > /usr/lib/machines/</filename> , <filename > /usr/lib/portables/</filename> ,
2023-04-06 11:30:34 +03:00
<filename > /usr/lib/confexts/</filename> , <filename > /var/lib/machines/</filename> ,
2022-11-29 18:39:06 +03:00
<filename > /var/lib/portables/</filename> , <filename > /var/lib/extensions/</filename> and so
2023-08-22 19:52:36 +03:00
on.</para>
<xi:include href= "version-info.xml" xpointer= "v253" /> </listitem>
2022-11-29 18:39:06 +03:00
</varlistentry>
2022-12-02 17:00:44 +03:00
<varlistentry >
<term > <option > --validate</option> </term>
<listitem > <para > Validates the partition arrangement of a disk image (DDI), and ensures it matches the
image policy specified via <option > --image-policy=</option> , if one is specified. This parses the
partition table and probes the file systems in the image, but does not attempt to mount them (nor to
set up disk encryption/authentication via LUKS/Verity). It does this taking the configured image
dissection policy into account. Since this operation does not mount file systems, this command –
unlike all other commands implemented by this tool – requires no privileges other than the ability to
access the specified file. Prints "OK" and returns zero if the image appears to be in order and
matches the specified image dissection policy. Otherwise prints an error message and returns
2023-08-22 19:52:36 +03:00
non-zero.</para>
<xi:include href= "version-info.xml" xpointer= "v254" /> </listitem>
2022-12-02 17:00:44 +03:00
</varlistentry>
2020-07-29 16:43:43 +03:00
<xi:include href= "standard-options.xml" xpointer= "help" />
<xi:include href= "standard-options.xml" xpointer= "version" />
</variablelist>
</refsect1>
<refsect1 >
<title > Options</title>
<para > The following options are understood:</para>
<variablelist >
<varlistentry >
<term > <option > --read-only</option> </term>
<term > <option > -r</option> </term>
<listitem > <para > Operate in read-only mode. By default <option > --mount</option> will establish
writable mount points. If this option is specified they are established in read-only mode
2023-08-22 19:52:36 +03:00
instead.</para>
<xi:include href= "version-info.xml" xpointer= "v247" /> </listitem>
2020-07-29 16:43:43 +03:00
</varlistentry>
<varlistentry >
<term > <option > --fsck=no</option> </term>
<listitem > <para > Turn off automatic file system checking. By default when an image is accessed for
2021-04-21 18:00:45 +03:00
writing (by <option > --mount</option> or <option > --copy-to</option> ) the file systems contained in the
OS image are automatically checked using the appropriate <citerefentry
2020-07-29 16:43:43 +03:00
project='man-pages'><refentrytitle > fsck</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry>
command, in automatic fixing mode. This behavior may be switched off using
2023-08-22 19:52:36 +03:00
<option > --fsck=no</option> .</para>
<xi:include href= "version-info.xml" xpointer= "v247" /> </listitem>
2020-07-29 16:43:43 +03:00
</varlistentry>
2021-04-21 17:41:12 +03:00
<varlistentry >
<term > <option > --growfs=no</option> </term>
<listitem > <para > Turn off automatic growing of accessed file systems to their partition size, if
marked for that in the GPT partition table. By default when an image is accessed for writing (by
<option > --mount</option> or <option > --copy-to</option> ) the file systems contained in the OS image
are automatically grown to their partition sizes, if bit 59 in the GPT partition flags is set for
partition types that are defined by the <ulink
2022-11-14 11:44:39 +03:00
url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable Partitions Specification</ulink> . This
2021-04-21 17:41:12 +03:00
behavior may be switched off using <option > --growfs=no</option> . File systems are grown automatically
on access if all of the following conditions are met:</para>
<orderedlist >
<listitem > <para > The file system is mounted writable</para> </listitem>
<listitem > <para > The file system currently is smaller than the partition it is contained in (and thus can be grown)</para> </listitem>
<listitem > <para > The image contains a GPT partition table</para> </listitem>
<listitem > <para > The file system is stored on a partition defined by the Discoverable Partitions Specification</para> </listitem>
<listitem > <para > Bit 59 of the GPT partition flags for this partition is set, as per specification</para> </listitem>
<listitem > <para > The <option > --growfs=no</option> option is not passed.</para> </listitem>
</orderedlist>
2023-08-22 19:52:36 +03:00
<xi:include href= "version-info.xml" xpointer= "v249" />
2021-04-21 17:41:12 +03:00
</listitem>
</varlistentry>
2020-07-29 16:43:43 +03:00
<varlistentry >
<term > <option > --mkdir</option> </term>
<listitem > <para > If combined with <option > --mount</option> the directory to mount the OS image to is
created if it is missing. Note that the directory is not automatically removed when the disk image is
2023-08-22 19:52:36 +03:00
unmounted again.</para>
<xi:include href= "version-info.xml" xpointer= "v247" /> </listitem>
2020-07-29 16:43:43 +03:00
</varlistentry>
2022-07-28 02:55:11 +03:00
<varlistentry >
<term > <option > --rmdir</option> </term>
<listitem > <para > If combined with <option > --umount</option> the specified directory where the OS image
2023-08-22 19:52:36 +03:00
is mounted is removed after unmounting the OS image.</para>
<xi:include href= "version-info.xml" xpointer= "v252" /> </listitem>
2022-07-28 02:55:11 +03:00
</varlistentry>
2020-07-29 16:43:43 +03:00
<varlistentry >
<term > <option > --discard=</option> </term>
<listitem > <para > Takes one of <literal > disabled</literal> , <literal > loop</literal> ,
<literal > all</literal> , <literal > crypto</literal> . If <literal > disabled</literal> the image is
2021-01-28 22:38:27 +03:00
accessed with empty block discarding turned off. If <literal > loop</literal> discarding is enabled if
2020-07-29 16:43:43 +03:00
operating on a regular file. If <literal > crypt</literal> discarding is enabled even on encrypted file
2023-08-22 19:52:36 +03:00
systems. If <literal > all</literal> discarding is unconditionally enabled.</para>
<xi:include href= "version-info.xml" xpointer= "v247" /> </listitem>
2020-07-29 16:43:43 +03:00
</varlistentry>
2022-12-08 14:46:24 +03:00
<varlistentry >
<term > <option > --in-memory</option> </term>
<listitem > <para > If specified an in-memory copy of the specified disk image is used. This may be used
to operate with write-access on a (possibly read-only) image, without actually modifying the original
file. This may also be used in order to operate on a disk image without keeping the originating file
2023-08-22 19:52:36 +03:00
system busy, in order to allow it to be unmounted.</para>
<xi:include href= "version-info.xml" xpointer= "v253" /> </listitem>
2022-12-08 14:46:24 +03:00
</varlistentry>
2020-07-29 16:43:43 +03:00
<varlistentry >
<term > <option > --root-hash=</option> </term>
<term > <option > --root-hash-sig=</option> </term>
<term > <option > --verity-data=</option> </term>
2021-01-28 22:38:27 +03:00
<listitem > <para > Configure various aspects of Verity data integrity for the OS image. Option
<option > --root-hash=</option> specifies a hex-encoded top-level Verity hash to use for setting up the
Verity integrity protection. Option <option > --root-hash-sig=</option> specifies the path to a file
containing a PKCS#7 signature for the hash. This signature is passed to the kernel during activation,
which will match it against signature keys available in the kernel keyring. Option
<option > --verity-data=</option> specifies a path to a file with the Verity data to use for the OS
image, in case it is stored in a detached file. It is recommended to embed the Verity data directly
in the image, using the Verity mechanisms in the <ulink
2022-11-14 11:44:39 +03:00
url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable Partitions Specification</ulink> .
2023-08-22 19:52:36 +03:00
</para>
<xi:include href= "version-info.xml" xpointer= "v247" /> </listitem>
2020-07-29 16:43:43 +03:00
</varlistentry>
2023-03-06 14:00:45 +03:00
<varlistentry >
<term > <option > --loop-ref=</option> </term>
<listitem > <para > Configures the "reference" string the kernel shall report as backing file for the
loopback block device. While this is supposed to be a path or filename referencing the backing file,
this is not enforced and the kernel accepts arbitrary free-form strings, chosen by the user. Accepts
arbitrary strings up to a length of 63 characters. This sets the kernel's
<literal > .lo_file_name</literal> field for the block device. Note this is distinct from the
<filename > /sys/class/block/loopX/loop/backing_file</filename> attribute file that always reports a
path referring to the actual backing file. The latter is subject to mount namespace translation, the
2023-07-21 04:26:13 +03:00
former is not.</para>
<para > This setting is particularly useful in combination with the <option > --attach</option> command,
as it allows later referencing the allocated loop device via
<filename > /dev/disk/by-loop-ref/…</filename> symlinks. Example: first, set up the loopback device
via <command > systemd-dissect attach --loop-ref=quux foo.raw</command> , and then reference it in a
command via the specified filename: <command > cfdisk /dev/disk/by-loop-ref/quux</command> .
2023-08-22 19:52:36 +03:00
</para>
<xi:include href= "version-info.xml" xpointer= "v254" /> </listitem>
2023-03-06 14:00:45 +03:00
</varlistentry>
2023-07-06 12:24:22 +03:00
<varlistentry >
<term > <option > --mtree-hash=no</option> </term>
<listitem > <para > If combined with <option > --mtree</option> , turns off inclusion of file hashes in the
mtree output. This makes the <option > --mtree</option> faster when operating on large images.
2023-08-22 19:52:36 +03:00
</para>
<xi:include href= "version-info.xml" xpointer= "v254" /> </listitem>
2023-07-06 12:24:22 +03:00
</varlistentry>
2022-12-02 00:41:47 +03:00
<xi:include href= "standard-options.xml" xpointer= "image-policy-open" />
2021-01-21 20:12:23 +03:00
<xi:include href= "standard-options.xml" xpointer= "no-pager" />
<xi:include href= "standard-options.xml" xpointer= "no-legend" />
2021-01-21 20:21:41 +03:00
<xi:include href= "standard-options.xml" xpointer= "json" />
2020-07-29 16:43:43 +03:00
</variablelist>
</refsect1>
<refsect1 >
<title > Exit status</title>
2022-11-08 19:36:46 +03:00
<para > On success, 0 is returned, a non-zero failure code otherwise. If the <option > --with</option>
command is used the exit status of the invoked command is propagated.</para>
</refsect1>
2023-03-06 20:48:18 +03:00
<refsect1 >
<title > Invocation as <command > /sbin/mount.ddi</command> </title>
<para > The <command > systemd-dissect</command> executable may be symlinked to
<filename > /sbin/mount.ddi</filename> . If invoked through that it implements <citerefentry
project='man-pages'><refentrytitle > mount</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> 's
"external helper" interface for the (pseudo) file system type <literal > ddi</literal> . This means
conformant disk images may be mounted directly via</para>
<programlisting > # mount -t ddi myimage.raw targetdir/</programlisting>
<para > in a fashion mostly equivalent to:</para>
<programlisting > # systemd-dissect --mount myimage.raw targetdir/</programlisting>
<para > Note that since a single DDI may contain multiple file systems it should later be unmounted with
<command > umount -R targetdir/</command> , for recursive operation.</para>
<para > This functionality is particularly useful to mount DDIs automatically at boot via simple
<filename > /etc/fstab</filename> entries. For example:</para>
<programlisting > /path/to/myimage.raw /images/myimage/ ddi defaults 0 0</programlisting>
<para > When invoked this way the mount options <literal > ro</literal> , <literal > rw</literal> ,
<literal > discard</literal> , <literal > nodiscard</literal> map to the corresponding options listed above
(i.e. <option > --read-only</option> , <option > --discard=all</option> ,
<option > --discard=disabled</option> ). Mount options are <emphasis > not</emphasis> generically passed on to
the file systems inside the images.</para>
</refsect1>
2022-11-08 19:36:46 +03:00
<refsect1 >
<title > Examples</title>
<example >
2024-01-24 14:28:41 +03:00
<title > Generate a tarball from an OS disk image (<option > --with</option> )</title>
2022-11-08 19:36:46 +03:00
2023-03-06 20:48:18 +03:00
<programlisting > # systemd-dissect --with foo.raw tar cz . >foo.tar.gz</programlisting>
2022-11-08 19:36:46 +03:00
</example>
2024-01-24 14:28:41 +03:00
<para > or alternatively just:</para>
<example >
<title > Generate a tarball from an OS disk image (<option > --make-archive</option> )</title>
<programlisting > # systemd-dissect --make-archive foo.raw foo.tar.gz</programlisting>
</example>
2020-07-29 16:43:43 +03:00
</refsect1>
<refsect1 >
<title > See Also</title>
2023-12-22 21:09:32 +03:00
<para > <simplelist type= "inline" >
<member > <citerefentry > <refentrytitle > systemd</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> </member>
<member > <citerefentry > <refentrytitle > systemd-nspawn</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> </member>
<member > <citerefentry > <refentrytitle > systemd.exec</refentrytitle> <manvolnum > 5</manvolnum> </citerefentry> </member>
2023-11-16 13:31:02 +03:00
<member > <citerefentry > <refentrytitle > systemd.v</refentrytitle> <manvolnum > 7</manvolnum> </citerefentry> </member>
2023-12-22 21:09:32 +03:00
<member > <ulink url= "https://uapi-group.org/specifications/specs/discoverable_partitions_specification" > Discoverable Partitions Specification</ulink> </member>
<member > <citerefentry project= 'man-pages' > <refentrytitle > mount</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> </member>
<member > <citerefentry project= 'man-pages' > <refentrytitle > umount</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> </member>
<member > <citerefentry project= 'man-pages' > <refentrytitle > fdisk</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> </member>
</simplelist> </para>
2020-07-29 16:43:43 +03:00
</refsect1>
</refentry>