unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Richard Sent <richard@freakingpenguin.com>
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>, 74837@debbugs.gnu.org
Subject: [bug#74837] [PATCH v2 1/2] gnu: services: Add resize-fs-service.
Date: Sat, 14 Dec 2024 16:23:27 +0100	[thread overview]
Message-ID: <874j36mgpc.fsf@gnu.org> (raw)
In-Reply-To: <472c97dc7cb15bc73e93576868d4da8517d2ddb5.1734038130.git.richard@freakingpenguin.com> (Richard Sent's message of "Thu, 12 Dec 2024 16:15:29 -0500")

Hello,

Richard Sent <richard@freakingpenguin.com> skribis:

> * gnu/services/admin.scm (resize-fs-configuration): New configuration
> type.
> (resize-fs-shepherd-service): New procedure.
> (resize-fs-service-type): New variable.
> * doc/guix.texi (Miscallaneous Services): Document it.
>
> Change-Id: Icae2fefc9a8d936d4c3add47520258b341f689a4

Nice!  Overall LGTM.  Minor comments below.

> +@subsubheading Resize File System service
> +
> +This service type lets you resize a live file system during boot, which
> +can be convenient if a Guix image is flashed on an SD Card (e.g. for an
> +embedded device) or uploaded to a VPS.  In both cases the medium the
> +image will reside upon may be larger than the image you want to produce.
> +
> +For an embedded device booting from an SD card you may use something like:
> +@lisp
> +(service resize-fs-service-type
> +  (resize-fs-configuration
> +    (file-system
> +     (device (file-system-label "root"))
> +     (type "ext4"))))
> +@end lisp

I would avoid abbreviations as usual and go for
‘file-system-resizing-service-type’.  WDYT?

> +Be extra cautious to use the correct device and type.  The service has
> +little error handling of its own and relies on the underlying tools.
> +Wrong use could end in loss of data or the corruption of the operating
> +system.

Maybe wrap this paragraph in “@quotation Warning”.

> +@item @code{file-system} (default: @code{#f}) (type: file-system)
> +The file-system object to resize.  This object must have the device and
                                   ^
Maybe add “(@pxref{File Systems})”.

> +type fields set.  The others are ignored.

“the @code{device} and @code{type} fields set.  Other fields are
ignored.”

> +@item @code{cloud-utils} (default: @code{cloud-utils}) (type: file-like)
> +The cloud-utils package to use.

Maybe add a sentence explaining that ‘cloud-utils’ is used for its
‘growpart’ command.

I wonder if Guile-Parted could be used instead of ‘growpart’ (shouldn’t
be a blocker though).

> +                    (let/ec return
> +                      (guard (c ((and (invoke-error? c)
> +                                      ;; growpart NOCHANGE exits with 1. It is
> +                                      ;; unlikely the partition was resized
> +                                      ;; while the file system was not. Just
> +                                      ;; exit.
> +                                      (equal? (invoke-error-exit-status c) 1))
> +                                 (format (current-error-port)
> +                                         "The device ~a is already resized.~%" device)
> +                                 ;; Must return something or Shepherd considers
> +                                 ;; the service perpetually starting.
> +                                 (return 0)))
> +                        (apply invoke grow-partition-command))
> +                      (apply invoke grow-filesystem-command)))))))))

No need for ‘let/ec’ here, you can just return from the ‘guard’ handler.

The second patch LGTM, though perhaps it should come before this patch
since it fixes something that the resize service needs.

Could you send updated patches?

Thanks!

Ludo’.




  parent reply	other threads:[~2024-12-14 15:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12 20:16 [bug#74837] [PATCH 0/2] Add resize-fs service Richard Sent
2024-12-12 20:18 ` [bug#74837] [PATCH 1/2] gnu: services: Add resize-fs-service Richard Sent
2024-12-12 20:19 ` [bug#74837] [PATCH 2/2] packages: cloud-utils: Add missing growpart programs to path Richard Sent
2024-12-12 21:15 ` [bug#74837] [PATCH v2 1/2] gnu: services: Add resize-fs-service Richard Sent
2024-12-12 21:15   ` [bug#74837] [PATCH v2 2/2] packages: cloud-utils: Add missing growpart programs to path Richard Sent
2024-12-14 15:23   ` Ludovic Courtès [this message]
2024-12-14 21:18 ` [bug#74837] [PATCH v3 0/2] resize-file-system-service Richard Sent
2024-12-14 21:18   ` [bug#74837] [PATCH v3 1/2] packages: cloud-utils: Add missing growpart programs to path Richard Sent
2024-12-14 21:18   ` [bug#74837] [PATCH v3 2/2] gnu: services: Add resize-file-system-service Richard Sent

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874j36mgpc.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=74837@debbugs.gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    --cc=richard@freakingpenguin.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).