From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 44353@debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe@gnu.org>,
Jesse Gibbons <jgibbons2357@gmail.com>,
Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: bug#44353: [PATCH version-1.2.0 v2] guix: system: Add a new '--non-volatile' option for disk-image.
Date: Thu, 12 Nov 2020 02:09:17 -0500 [thread overview]
Message-ID: <20201112070917.11794-1-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <87h7q0cdns.fsf@gnu.org>
* guix/scripts/system.scm (%options)[volatile-root?]: New boolean option.
(%default-options): Set its default value to #f.
(show-help): Add help doc.
* guix/scripts/system.scm (perform-action): Propagate option...
(system-derivation-for-action): ...here. Use it to set the volatile-root?
field of the image object passed to SYSTEM-IMAGE.
* doc/guix.texi (Invoking guix system): Document it.
---
doc/guix.texi | 18 ++++++++++++------
guix/scripts/system.scm | 21 +++++++++++++++++----
2 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index e15ee4092c..30efb7fc97 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -30911,14 +30911,20 @@ the @option{--image-size} option is ignored in the case of
@cindex disk-image, creating disk images
The @code{disk-image} command can produce various image types. The
-image type can be selected using the @command{--image-type} option. It
+image type can be selected using the @option{--image-type} option. It
defaults to @code{raw}. When its value is @code{iso9660}, the
@option{--label} option can be used to specify a volume ID with
-@code{disk-image}. When using @code{disk-image}, the bootloader
-installed on the generated image is taken from the provided
-@code{operating-system} definition. The following example demonstrates
-how to generate an image that uses the @code{grub-efi-bootloader}
-bootloader and boot it with QEMU:
+@code{disk-image}. By default, the root file system of a disk image is
+mounted volatile; the @option{--non-volatile} option can be used to make
+it persistent instead. The @option{--non-volatile} is useful to make
+use of extra disk space that can be obtained by using a larger value for
+the @option{--image-size} option; otherwise, the amount of physical
+memory available determines the capacity of the volatile file system
+overlay used for the root file system. When using @code{disk-image},
+the bootloader installed on the generated image is taken from the
+provided @code{operating-system} definition. The following example
+demonstrates how to generate an image that uses the
+@code{grub-efi-bootloader} bootloader and boot it with QEMU:
@example
image=$(guix system disk-image --image-type=qcow2 \
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index ad998156c2..004f1c9739 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -674,7 +674,8 @@ checking this by themselves in their 'check' procedure."
(define* (system-derivation-for-action os action
#:key image-size image-type
full-boot? container-shared-network?
- mappings label)
+ mappings label
+ volatile-root?)
"Return as a monadic value the derivation for OS according to ACTION."
(mlet %store-monad ((target (current-target-system)))
(case action
@@ -706,7 +707,8 @@ checking this by themselves in their 'check' procedure."
base-image))
(target (or base-target target))
(size image-size)
- (operating-system os))))))
+ (operating-system os)
+ (volatile-root? volatile-root?))))))
((docker-image)
(system-docker-image os
#:shared-network? container-shared-network?)))))
@@ -761,6 +763,7 @@ and TARGET arguments."
dry-run? derivations-only?
use-substitutes? bootloader-target target
image-size image-type
+ volatile-root?
full-boot? label container-shared-network?
(mappings '())
(gc-root #f))
@@ -768,7 +771,8 @@ and TARGET arguments."
bootloader; BOOTLOADER-TAGET is the target for the bootloader; TARGET is the
target root directory; IMAGE-SIZE is the size of the image to be built, for
the 'vm-image' and 'disk-image' actions. IMAGE-TYPE is the type of image to
-be built.
+be built. When VOLATILE-ROOT? is #t, the root file system is mounted
+volatile.
FULL-BOOT? is used for the 'vm' action; it determines whether to
boot directly to the kernel or to the bootloader. CONTAINER-SHARED-NETWORK?
@@ -816,6 +820,7 @@ static checks."
#:label label
#:image-type image-type
#:image-size image-size
+ #:volatile-root? volatile-root?
#:full-boot? full-boot?
#:container-shared-network? container-shared-network?
#:mappings mappings))
@@ -974,6 +979,8 @@ Some ACTIONS support additional ARGS.\n"))
--image-size=SIZE for 'vm-image', produce an image of SIZE"))
(display (G_ "
--no-bootloader for 'init', do not install a bootloader"))
+ (display (G_ "
+ --non-volatile for 'disk-image', persist root file system changes"))
(display (G_ "
--label=LABEL for 'disk-image', label disk image with LABEL"))
(display (G_ "
@@ -1048,6 +1055,9 @@ Some ACTIONS support additional ARGS.\n"))
(option '("no-bootloader" "no-grub") #f #f
(lambda (opt name arg result)
(alist-cons 'install-bootloader? #f result)))
+ (option '("non-volatile") #f #f
+ (lambda (opt name arg result)
+ (alist-cons 'volatile-root? #f result)))
(option '("label") #t #f
(lambda (opt name arg result)
(alist-cons 'label arg result)))
@@ -1109,7 +1119,8 @@ Some ACTIONS support additional ARGS.\n"))
(image-type . raw)
(image-size . guess)
(install-bootloader? . #t)
- (label . #f)))
+ (label . #f)
+ (volatile-root? . #t)))
(define (verbosity-level opts)
"Return the verbosity level based on OPTS, the alist of parsed options."
@@ -1206,6 +1217,8 @@ resulting from command-line parsing."
#:image-type (lookup-image-type-by-name
(assoc-ref opts 'image-type))
#:image-size (assoc-ref opts 'image-size)
+ #:volatile-root?
+ (assoc-ref opts 'volatile-root?)
#:full-boot? (assoc-ref opts 'full-boot?)
#:container-shared-network?
(assoc-ref opts 'container-shared-network?)
--
2.28.0
next prev parent reply other threads:[~2020-11-12 7:11 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-31 16:47 bug#44353: guix system disk-image -t raw fails with grub-efi-bootloader Jesse Gibbons
2020-11-07 7:09 ` Maxim Cournoyer
2020-11-07 9:08 ` Mathieu Othacehe
2020-11-07 11:26 ` Bengt Richter
2020-11-07 20:32 ` Maxim Cournoyer
2020-11-08 11:04 ` Mathieu Othacehe
2020-11-12 3:57 ` bug#44353: [PATCH version-1.2.0 v2 1/3] image: Remove conflicting user-provided EFI file system Maxim Cournoyer
2020-11-12 3:57 ` bug#44353: [PATCH version-1.2.0 v2 2/3] bootloader: grub: Skip install-grub-efi when producing a disk image Maxim Cournoyer
2020-11-12 8:42 ` Mathieu Othacehe
2020-11-17 18:29 ` Maxim Cournoyer
2020-11-12 3:57 ` bug#44353: [PATCH version-1.2.0 v2 3/3] doc: Detail which bootloader get used with disk-image or vm-image Maxim Cournoyer
2020-11-12 8:45 ` Mathieu Othacehe
2020-11-12 21:16 ` Ludovic Courtès
2020-11-12 8:39 ` bug#44353: [PATCH version-1.2.0 v2 1/3] image: Remove conflicting user-provided EFI file system Mathieu Othacehe
2020-11-17 18:37 ` Maxim Cournoyer
2020-11-12 7:09 ` Maxim Cournoyer [this message]
2020-11-12 8:36 ` bug#44353: [PATCH version-1.2.0 v2] guix: system: Add a new '--non-volatile' option for disk-image Mathieu Othacehe
2020-11-12 14:59 ` Maxim Cournoyer
2020-11-12 17:06 ` Mathieu Othacehe
2020-11-17 14:44 ` Maxim Cournoyer
2020-11-12 21:18 ` Ludovic Courtès
2020-11-16 2:48 ` Maxim Cournoyer
2020-11-15 21:45 ` Ludovic Courtès
2020-11-16 3:47 ` Maxim Cournoyer
2020-11-16 9:23 ` Mathieu Othacehe
2020-11-16 13:09 ` Ludovic Courtès
2020-11-16 13:34 ` Mathieu Othacehe
2020-11-17 20:21 ` Maxim Cournoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201112070917.11794-1-maxim.cournoyer@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=44353@debbugs.gnu.org \
--cc=jgibbons2357@gmail.com \
--cc=othacehe@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.