mirror of
https://github.com/systemd/systemd
synced 2024-10-14 20:17:52 +00:00
dissect: enable growfs by default, but make it configurable
This adds a new --growfs=yes|no switch to systemd-dissect, defaulting to on.
This commit is contained in:
parent
81939d9d5e
commit
74a54baeec
|
@ -194,6 +194,28 @@
|
||||||
<option>--fsck=no</option>.</para></listitem>
|
<option>--fsck=no</option>.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<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
|
||||||
|
url="https://systemd.io/DISCOVERABLE_PARTITIONS">Discoverable Partitions Specification</ulink>. This
|
||||||
|
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>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--mkdir</option></term>
|
<term><option>--mkdir</option></term>
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@ static DissectImageFlags arg_flags =
|
||||||
DISSECT_IMAGE_DISCARD_ON_LOOP |
|
DISSECT_IMAGE_DISCARD_ON_LOOP |
|
||||||
DISSECT_IMAGE_RELAX_VAR_CHECK |
|
DISSECT_IMAGE_RELAX_VAR_CHECK |
|
||||||
DISSECT_IMAGE_FSCK |
|
DISSECT_IMAGE_FSCK |
|
||||||
DISSECT_IMAGE_USR_NO_ROOT;
|
DISSECT_IMAGE_USR_NO_ROOT |
|
||||||
|
DISSECT_IMAGE_GROWFS;
|
||||||
static VeritySettings arg_verity_settings = VERITY_SETTINGS_DEFAULT;
|
static VeritySettings arg_verity_settings = VERITY_SETTINGS_DEFAULT;
|
||||||
static JsonFormatFlags arg_json_format_flags = JSON_FORMAT_OFF;
|
static JsonFormatFlags arg_json_format_flags = JSON_FORMAT_OFF;
|
||||||
static PagerFlags arg_pager_flags = 0;
|
static PagerFlags arg_pager_flags = 0;
|
||||||
|
@ -75,6 +76,7 @@ static int help(void) {
|
||||||
" --no-legend Do not show the headers and footers\n"
|
" --no-legend Do not show the headers and footers\n"
|
||||||
" -r --read-only Mount read-only\n"
|
" -r --read-only Mount read-only\n"
|
||||||
" --fsck=BOOL Run fsck before mounting\n"
|
" --fsck=BOOL Run fsck before mounting\n"
|
||||||
|
" --growfs=BOOL Grow file system to partition size, if marked\n"
|
||||||
" --mkdir Make mount directory before mounting, if missing\n"
|
" --mkdir Make mount directory before mounting, if missing\n"
|
||||||
" --discard=MODE Choose 'discard' mode (disabled, loop, all, crypto)\n"
|
" --discard=MODE Choose 'discard' mode (disabled, loop, all, crypto)\n"
|
||||||
" --root-hash=HASH Specify root hash for verity\n"
|
" --root-hash=HASH Specify root hash for verity\n"
|
||||||
|
@ -112,6 +114,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||||
ARG_NO_LEGEND,
|
ARG_NO_LEGEND,
|
||||||
ARG_DISCARD,
|
ARG_DISCARD,
|
||||||
ARG_FSCK,
|
ARG_FSCK,
|
||||||
|
ARG_GROWFS,
|
||||||
ARG_ROOT_HASH,
|
ARG_ROOT_HASH,
|
||||||
ARG_ROOT_HASH_SIG,
|
ARG_ROOT_HASH_SIG,
|
||||||
ARG_VERITY_DATA,
|
ARG_VERITY_DATA,
|
||||||
|
@ -128,6 +131,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||||
{ "read-only", no_argument, NULL, 'r' },
|
{ "read-only", no_argument, NULL, 'r' },
|
||||||
{ "discard", required_argument, NULL, ARG_DISCARD },
|
{ "discard", required_argument, NULL, ARG_DISCARD },
|
||||||
{ "fsck", required_argument, NULL, ARG_FSCK },
|
{ "fsck", required_argument, NULL, ARG_FSCK },
|
||||||
|
{ "growfs", required_argument, NULL, ARG_GROWFS },
|
||||||
{ "root-hash", required_argument, NULL, ARG_ROOT_HASH },
|
{ "root-hash", required_argument, NULL, ARG_ROOT_HASH },
|
||||||
{ "root-hash-sig", required_argument, NULL, ARG_ROOT_HASH_SIG },
|
{ "root-hash-sig", required_argument, NULL, ARG_ROOT_HASH_SIG },
|
||||||
{ "verity-data", required_argument, NULL, ARG_VERITY_DATA },
|
{ "verity-data", required_argument, NULL, ARG_VERITY_DATA },
|
||||||
|
@ -264,6 +268,14 @@ static int parse_argv(int argc, char *argv[]) {
|
||||||
SET_FLAG(arg_flags, DISSECT_IMAGE_FSCK, r);
|
SET_FLAG(arg_flags, DISSECT_IMAGE_FSCK, r);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ARG_GROWFS:
|
||||||
|
r = parse_boolean(optarg);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to parse --growfs= parameter: %s", optarg);
|
||||||
|
|
||||||
|
SET_FLAG(arg_flags, DISSECT_IMAGE_GROWFS, r);
|
||||||
|
break;
|
||||||
|
|
||||||
case ARG_JSON:
|
case ARG_JSON:
|
||||||
r = parse_json_argument(optarg, &arg_json_format_flags);
|
r = parse_json_argument(optarg, &arg_json_format_flags);
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
|
|
Loading…
Reference in a new issue