all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Guix system image record with a large root partition
@ 2024-05-22  4:55 bdunahu
  2024-06-12 21:01 ` Sergey Trofimov
  0 siblings, 1 reply; 5+ messages in thread
From: bdunahu @ 2024-05-22  4:55 UTC (permalink / raw)
  To: help-guix

Hello!

I would like to create a Guix System bootable from a USB. I am trying to
configure an image record that will allow me to create this image with a
large enough root partition (my USB is 32GB) that I can also instantiate
my home configuration on it, whether manually or programatically later.

I have tried two different ways of creating an image with a large
root partition, but am having difficulty with both:

(define system
  (operating-system
   ...)) ;; simplified

(define MiB (expt 2 20))
(define GiB (expt 2 30))

(image
 (format 'disk-image)
 (operating-system system)
 (partitions
  (list
   (partition
    (size (* 40 MiB))
    (offset (* 1024 1024))
    (label "GNU-ESP")
    (file-system "vfat")
    (flags '(esp))
    (initializer (gexp initialize-efi-partition)))
   (partition
    (size (* 28 GiB))
    (label root-label)
    (file-system "ext4")
    (flags '(boot))
    (initializer (gexp initialize-root-partition))))))

;; the above image declaraction is in kvasir.scm
$ guix system -L ~/.config/guix/modules/ image ~/.config/guix/kvasir.scm 

This generates correctly sized and offset partitions, but unfortunately
results in a broken grub configuration. The program packages are there,
but the /root directory is missing as well; so is my user (all part of the
shared 'system' declaration I use to configure the computer I write this
on) and the guixbuild user group...

I then tried to use a different image format (iso9660), which I based off of
the existing iso9660-image included in the existing images module (so
the same as the above but no ESP partition):

(image
 (format 'iso9660)
 (operating-system system)
 (partitions
  (list
   (partition
    (size (* 28 GiB))
    (label root-label)
    (file-system "ext4")
    (flags '(boot))
    (initializer (gexp initialize-root-partition))))))


This creates a full, working configuration, but also ignores my size and
offset specifications (the root partition is ~2GiB, and starts at block
0). I have tried to resize the partition manually using fdisk, but
because the boot partition starts after the root partition, this also
seems impossible (and more of a duct-tape solution).


So I am not sure how to get the image I want. If anyone were able to
help me fix my image record (or better solutions, or even a suggestion
as to why mine doesn't work) to generate a simple image that works on
most modern computers and has a large root partition, it would be very
helpful to me.

Thanks!
bd


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Guix system image record with a large root partition
  2024-05-22  4:55 Guix system image record with a large root partition bdunahu
@ 2024-06-12 21:01 ` Sergey Trofimov
  2024-06-12 23:17   ` Richard Sent
  2024-06-12 23:46   ` bdunahu
  0 siblings, 2 replies; 5+ messages in thread
From: Sergey Trofimov @ 2024-06-12 21:01 UTC (permalink / raw)
  To: bdunahu; +Cc: help-guix


Hi,
I've documented my approach here: 
http://sarg.org.ru/blog/guix-restore-drill/
tldr - create an efi image, dd to the target disk, resize the fs.

Building a full-sized disk image seems wasteful, especially for 
large partitions.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Guix system image record with a large root partition
  2024-06-12 21:01 ` Sergey Trofimov
@ 2024-06-12 23:17   ` Richard Sent
  2024-06-13  7:44     ` Christoph Buck
  2024-06-12 23:46   ` bdunahu
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Sent @ 2024-06-12 23:17 UTC (permalink / raw)
  To: Sergey Trofimov; +Cc: bdunahu, help-guix

Sergey Trofimov <sarg@sarg.org.ru> writes:

> Building a full-sized disk image seems wasteful, especially for large
> partitions.

This hasn't been merged, but there was a patch proposed for a
resize-fs-service that would resize the partition on boot.
https://issues.guix.gnu.org/69090. Maybe worth taking a look at?

-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Guix system image record with a large root partition
  2024-06-12 21:01 ` Sergey Trofimov
  2024-06-12 23:17   ` Richard Sent
@ 2024-06-12 23:46   ` bdunahu
  1 sibling, 0 replies; 5+ messages in thread
From: bdunahu @ 2024-06-12 23:46 UTC (permalink / raw)
  To: Sergey Trofimov; +Cc: help-guix

Sergey Trofimov <sarg@sarg.org.ru> writes:

> Hi,
> I've documented my approach here:
> http://sarg.org.ru/blog/guix-restore-drill/

Thanks for sharing this detailed explanation! Based on this, the likely
issue with my disk image was that there was a label mismatch due to the
hardcoded values.
I also learned the missing home directories I mentioned are generated
only on first login, not when manually inspecting the disk image
beforehand.

I ended up using the guix home service to generate an iso that would
include all of my programs/services with no manual configuration.

Thanks again! I may use this to return to the first approach.
bd


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Guix system image record with a large root partition
  2024-06-12 23:17   ` Richard Sent
@ 2024-06-13  7:44     ` Christoph Buck
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Buck @ 2024-06-13  7:44 UTC (permalink / raw)
  To: Richard Sent; +Cc: Sergey Trofimov, bdunahu, help-guix

Hi!

> This hasn't been merged, but there was a patch proposed for a
> resize-fs-service that would resize the partition on boot.
> https://issues.guix.gnu.org/69090. Maybe worth taking a look at?

This is indeed very helpfull. I was already looking for an option like
this in guix. Thanks for pointing me to this patch.

I build system images for the rpi4, which are booted from a ssd
hdd. Before using guix, i used nix, where an option to resize
the partition on first boot is avaialble.

I was about to ask on this list how the same behavior can be achieved in
guix.

-- 
Best regards

Christoph


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-13  7:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-22  4:55 Guix system image record with a large root partition bdunahu
2024-06-12 21:01 ` Sergey Trofimov
2024-06-12 23:17   ` Richard Sent
2024-06-13  7:44     ` Christoph Buck
2024-06-12 23:46   ` bdunahu

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.