From: Daan De Meyer Date: Sun, 7 May 2023 07:10:19 +0000 (+0200) Subject: Give disk images some extra free disk space when we boot them X-Git-Tag: v15~177^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2201019d21c227dc0273e128ddc7e2c74d1de595;p=thirdparty%2Fmkosi.git Give disk images some extra free disk space when we boot them truncate creates the extra disk space sparse so this doesn't affect the host's disk usage. The extra disk space will have to be partitioned to be usable inside the image though (but this is perfect for systemd's use case as we want to partition the free space with systemd-repart). --- diff --git a/NEWS.md b/NEWS.md index bf70d6e37..9b2e09646 100644 --- a/NEWS.md +++ b/NEWS.md @@ -82,6 +82,8 @@ - `--base-image` is split into `--base-tree` and `--overlay`. - Removed `--cache-initrd`, instead, use a prebuilt initrd with `Initrds=` to avoid rebuilding the initrd all the time. +- Disk images are now resized to 8G when booted to give some disk space to play around with in the booted + image. ## v14 diff --git a/mkosi/__init__.py b/mkosi/__init__.py index ebecd31da..3d21aadbf 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -2264,6 +2264,10 @@ def run_verb(args: MkosiArgs, presets: Sequence[MkosiConfig]) -> None: if build and args.auto_bump: bump_image_version() + # Give disk images some space to play around with if we're booting one. + if args.verb in (Verb.shell, Verb.boot, Verb.qemu) and last.output_format == OutputFormat.disk: + run(["truncate", "--size", "8G", last.output_dir / last.output]) + with prepend_to_environ_path(last.extra_search_paths): if args.verb in (Verb.shell, Verb.boot): run_shell(args, last)