]>
Commit | Line | Data |
---|---|---|
61f403a1 LP |
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+ --> | |
5 | ||
bb5a34fb | 6 | <refentry id="systemd-dissect" conditional='HAVE_BLKID' |
61f403a1 LP |
7 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
8 | ||
9 | <refentryinfo> | |
10 | <title>systemd-dissect</title> | |
11 | <productname>systemd</productname> | |
12 | </refentryinfo> | |
13 | ||
14 | <refmeta> | |
15 | <refentrytitle>systemd-dissect</refentrytitle> | |
16 | <manvolnum>1</manvolnum> | |
17 | </refmeta> | |
18 | ||
19 | <refnamediv> | |
20 | <refname>systemd-dissect</refname> | |
21 | <refpurpose>Dissect file system OS images</refpurpose> | |
22 | </refnamediv> | |
23 | ||
24 | <refsynopsisdiv> | |
25 | <cmdsynopsis> | |
26 | <command>systemd-dissect <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="plain"><replaceable>IMAGE</replaceable></arg></command> | |
27 | </cmdsynopsis> | |
28 | <cmdsynopsis> | |
29 | <command>systemd-dissect <arg choice="opt" rep="repeat">OPTIONS</arg> <option>--mount</option> <arg choice="plain"><replaceable>IMAGE</replaceable></arg> <arg choice="plain"><replaceable>PATH</replaceable></arg></command> | |
30 | </cmdsynopsis> | |
31 | <cmdsynopsis> | |
32 | <command>systemd-dissect <arg choice="opt" rep="repeat">OPTIONS</arg> <option>--copy-from</option> <arg choice="plain"><replaceable>IMAGE</replaceable></arg> <arg choice="plain"><replaceable>PATH</replaceable></arg> <arg choice="opt"><replaceable>TARGET</replaceable></arg></command> | |
33 | </cmdsynopsis> | |
34 | <cmdsynopsis> | |
35 | <command>systemd-dissect <arg choice="opt" rep="repeat">OPTIONS</arg> <option>--copy-to</option> <arg choice="plain"><replaceable>IMAGE</replaceable></arg> <arg choice="opt"><replaceable>SOURCE</replaceable></arg> <arg choice="plain"><replaceable>PATH</replaceable></arg></command> | |
36 | </cmdsynopsis> | |
37 | </refsynopsisdiv> | |
38 | ||
39 | <refsect1> | |
40 | <title>Description</title> | |
41 | ||
42 | <para><command>systemd-dissect</command> is a tool for introspecting and interacting with file system OS | |
43 | disk images. It supports four different operations:</para> | |
44 | ||
45 | <orderedlist> | |
46 | <listitem><para>Show general OS image information, including the image's | |
47 | <citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry> data, | |
48 | machine ID, partition information and more.</para></listitem> | |
49 | ||
50 | <listitem><para>Mount an OS image to a local directory. In this mode it will dissect the OS image and | |
51 | mount the included partitions according to their designation onto a directory and possibly | |
52 | sub-directories.</para></listitem> | |
53 | ||
54 | <listitem><para>Copy files and directories in and out of an OS image.</para></listitem> | |
55 | </orderedlist> | |
56 | ||
57 | <para>The tool may operate on three types of OS images:</para> | |
58 | ||
59 | <orderedlist> | |
60 | <listitem><para>OS disk images containing a GPT partition table envelope, with partitions marked | |
61 | according to the <ulink url="https://systemd.io/DISCOVERABLE_PARTITIONS">Discoverable Partitions | |
62 | Specification</ulink>.</para></listitem> | |
63 | ||
64 | <listitem><para>OS disk images containing just a plain file-system without an enveloping partition | |
65 | table. (This file system is assumed to be the root file system of the OS.)</para></listitem> | |
66 | ||
67 | <listitem><para>OS disk images containing a GPT or MBR partition table, with a single | |
68 | partition only. (This partition is assumed to contain the root file system of the OS.)</para></listitem> | |
69 | </orderedlist> | |
70 | ||
71 | <para>OS images may use any kind of Linux-supported file systems. In addition they may make use of LUKS | |
72 | disk encryption, and contain Verity integrity information. Note that qualifying OS images may be booted | |
73 | with <citerefentry><refentrytitle>system-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s | |
74 | <option>--image=</option> switch, and be used as root file system for system service using the | |
75 | <varname>RootImage=</varname> unit file setting, see | |
76 | <citerefentry><refentrytitle>system.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> | |
77 | </refsect1> | |
78 | ||
79 | <refsect1> | |
80 | <title>Commands</title> | |
81 | ||
82 | <para>If neither of the command switches listed below are passed the specified disk image is opened and | |
83 | general information about the image and the contained partitions and their use is shown.</para> | |
84 | ||
85 | <variablelist> | |
86 | <varlistentry> | |
87 | <term><option>--mount</option></term> | |
88 | <term><option>-m</option></term> | |
89 | ||
90 | <listitem><para>Mount the specified OS image to the specified directory. This will dissect the image, | |
91 | determine the OS root file system — as well as possibly other partitions — and mount them to the | |
92 | specified directory. If the OS image contains multiple partitions marked with the <ulink | |
93 | url="https://systemd.io/DISCOVERABLE_PARTITIONS">Discoverable Partitions Specification</ulink> | |
94 | multiple nested mounts are established. This command expects two arguments: a path to an image file | |
95 | and a path to a directory where to mount the image.</para> | |
96 | ||
97 | <para>To unmount an OS image mounted like this use <citerefentry | |
98 | project='man-pages'><refentrytitle>umount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s | |
99 | <option>-R</option> switch (for recursive operation), so that the OS image and all nested partition | |
100 | mounts are unmounted.</para> | |
101 | ||
102 | <para>When the OS image contains LUKS encrypted or Verity integrity protected file systems | |
103 | appropriate volumes are automatically set up and marked for automatic disassembly when the image is | |
104 | unmounted.</para> | |
105 | ||
106 | <para>The OS image may either be specified as path to an OS image stored in a regular file or may | |
107 | refer to block device node (in the latter case the block device must be the "whole" device, i.e. not | |
108 | a partition device). (The other supported commands described here support this, too.)</para> | |
109 | ||
110 | <para>All mounted file systems are checked with the appropriate <citerefentry | |
111 | project='man-pages'><refentrytitle>fsck</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
112 | implementation in automatic fixing mode, unless explicitly turned off (<option>--fsck=no</option>) or | |
113 | read-only operation is requested (<option>--read-only</option>).</para></listitem> | |
114 | </varlistentry> | |
115 | ||
116 | <varlistentry> | |
117 | <term><option>-M</option></term> | |
118 | ||
119 | <listitem><para>This is a shortcut for <option>--mount --mkdir</option>.</para></listitem> | |
120 | </varlistentry> | |
121 | ||
122 | <varlistentry> | |
123 | <term><option>--copy-from</option></term> | |
124 | <term><option>-x</option></term> | |
125 | ||
126 | <listitem><para>Copies a file or directory from the specified OS image into the specified location on | |
127 | the host file system. Expects three arguments: a path to an image file, a source path (relative to | |
128 | the image's root directory) and a destination path (relative to the current working directory, or an | |
129 | absolute path, both outside of the image). If the destination path is omitted or specified as dash | |
130 | (<literal>-</literal>), the specified file is written to standard output. If the source path in the | |
131 | image file system refers to a regular file it is copied to the destination path. In this case access | |
132 | mode, extended attributes and timestamps are copied as well, but file ownership is not. If the source | |
133 | path in the image refers to a directory, it is copied to the destination path, recursively with all | |
134 | containing files and directories. In this case the file ownership is copied too.</para></listitem> | |
135 | </varlistentry> | |
136 | ||
137 | <varlistentry> | |
138 | <term><option>--copy-to</option></term> | |
139 | <term><option>-a</option></term> | |
140 | ||
141 | <listitem><para>Copies a file or directory from the specified location in the host file system into | |
142 | the specified OS image. Expects three arguments: a path to an image file, a source path (relative to | |
143 | the current working directory, or an absolute path, both outside of the image) and a destination path | |
144 | (relative to the image's root directory). If the source path is omitted or specified as dash | |
145 | (<literal>-</literal>), the data to write is read from standard input. If the source path in the host | |
146 | file system refers to a regular file, it is copied to the destination path. In this case access mode, | |
147 | extended attributes and timestamps are copied as well, but file ownership is not. If the source path | |
148 | in the host file system refers to a directory it is copied to the destination path, recursively with | |
149 | all containing files and directories. In this case the file ownership is copied | |
150 | too.</para> | |
151 | ||
152 | <para>As with <option>--mount</option> file system checks are implicitly run before the copy | |
153 | operation begins.</para></listitem> | |
154 | </varlistentry> | |
155 | ||
de8231b0 LP |
156 | <varlistentry> |
157 | <term><option>--json=</option><replaceable>MODE</replaceable></term> | |
158 | ||
159 | <listitem><para>Shows output formatted as JSON. Expects one of <literal>short</literal> (for the | |
160 | shortest possible output without any redundant whitespace or line breaks), <literal>pretty</literal> | |
161 | (for a pretty version of the same, with indentation and line breaks) or <literal>off</literal> (to turn | |
162 | off json output).</para></listitem> | |
163 | </varlistentry> | |
164 | ||
61f403a1 LP |
165 | <xi:include href="standard-options.xml" xpointer="help" /> |
166 | <xi:include href="standard-options.xml" xpointer="version" /> | |
167 | </variablelist> | |
168 | ||
169 | </refsect1> | |
170 | ||
171 | <refsect1> | |
172 | <title>Options</title> | |
173 | ||
174 | <para>The following options are understood:</para> | |
175 | ||
176 | <variablelist> | |
177 | <varlistentry> | |
178 | <term><option>--read-only</option></term> | |
179 | <term><option>-r</option></term> | |
180 | ||
181 | <listitem><para>Operate in read-only mode. By default <option>--mount</option> will establish | |
182 | writable mount points. If this option is specified they are established in read-only mode | |
183 | instead.</para></listitem> | |
184 | </varlistentry> | |
185 | ||
186 | <varlistentry> | |
187 | <term><option>--fsck=no</option></term> | |
188 | ||
189 | <listitem><para>Turn off automatic file system checking. By default when an image is accessed for | |
190 | writing (by <option>--mount</option> or <option>--add</option>) the file systems contained in the OS | |
191 | image are automatically checked using the appropriate <citerefentry | |
192 | project='man-pages'><refentrytitle>fsck</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
193 | command, in automatic fixing mode. This behavior may be switched off using | |
194 | <option>--fsck=no</option>.</para></listitem> | |
195 | </varlistentry> | |
196 | ||
197 | <varlistentry> | |
198 | <term><option>--mkdir</option></term> | |
199 | ||
200 | <listitem><para>If combined with <option>--mount</option> the directory to mount the OS image to is | |
201 | created if it is missing. Note that the directory is not automatically removed when the disk image is | |
202 | unmounted again.</para></listitem> | |
203 | </varlistentry> | |
204 | ||
205 | <varlistentry> | |
206 | <term><option>--discard=</option></term> | |
207 | ||
208 | <listitem><para>Takes one of <literal>disabled</literal>, <literal>loop</literal>, | |
209 | <literal>all</literal>, <literal>crypto</literal>. If <literal>disabled</literal> the image is | |
210 | accessed with empty block discarding turned off. if <literal>loop</literal> discarding is enabled if | |
211 | operating on a regular file. If <literal>crypt</literal> discarding is enabled even on encrypted file | |
212 | systems. If <literal>all</literal> discarding is unconditionally enabled.</para></listitem> | |
213 | </varlistentry> | |
214 | ||
215 | <varlistentry> | |
216 | <term><option>--root-hash=</option></term> | |
217 | <term><option>--root-hash-sig=</option></term> | |
218 | <term><option>--verity-data=</option></term> | |
219 | ||
220 | <listitem><para>Configure various aspects of Verity data integrity for the OS | |
221 | image. <option>--root-hash=</option> expects a hex-encoding top-level Verity hash to use for setting | |
222 | up the Verity integrity protection. <option>--root-hash-sig=</option> expects the path to a file | |
223 | containing a PKCS#7 signature file for the hash. This signature is passed to the kernel during | |
224 | activation, which will match it against signature keys available in the kernel | |
225 | keyring. <option>--verity-data=</option> expects the path to a file with the Verity data to use for | |
226 | the OS image, in case it is stored in a detached file. It is recommended to embed the Verity data | |
227 | directly in the image, using the Verity mechanisms in the <ulink | |
228 | url="https://systemd.io/DISCOVERABLE_PARTITIONS">Discoverable Partitions Specification</ulink>.</para></listitem> | |
229 | </varlistentry> | |
230 | ||
231 | </variablelist> | |
232 | ||
233 | </refsect1> | |
234 | ||
235 | <refsect1> | |
236 | <title>Exit status</title> | |
237 | ||
238 | <para>On success, 0 is returned, a non-zero failure code | |
239 | otherwise.</para> | |
240 | </refsect1> | |
241 | ||
242 | <refsect1> | |
243 | <title>See Also</title> | |
244 | <para> | |
245 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
246 | <citerefentry><refentrytitle>system-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
247 | <citerefentry><refentrytitle>system.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
248 | <ulink url="https://systemd.io/DISCOVERABLE_PARTITIONS">Discoverable Partitions Specification</ulink>, | |
249 | <citerefentry project='man-pages'><refentrytitle>umount</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
250 | </para> | |
251 | </refsect1> | |
252 | ||
253 | </refentry> |