[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use genimage for disk-image creation.

From: Ludovic Courtès
Subject: Re: Use genimage for disk-image creation.
Date: Thu, 26 Mar 2020 15:19:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hi Mathieu!

Mathieu Othacehe <address@hidden> skribis:

> Let say I want to create a disk-image with one ext4 partition starting
> at offset 10M. I can write the following genimage config file:
> image system {
>       hdimage {}
>       partition rootfs {
>               partition-type = 0x83
>               image = "rootfs.ext4"
>               size = 8G
>               offset = 10M
>       }
> }
> image rootfs.ext4 {
>         name = "rootfs"
>         ext4 {
>                 label = "rootfs"
>               use-mke2fs = true
>         }
>         size = 8G
>         mountpoint = "/"
> }
> and run the command:
> fakeroot genimage --config ~/tmp/genimage.cfg 
> --rootpath=/home/mathieu/image-root/
> where image-root is a directory containing the result of a `guix system
> init`. The directory size is about 6GiB.
> It takes 8 minutes to generate this disk-image, versus 2h30 using `guix
> system disk-image`.
> I'm aware that this might not be a fair comparison but, I think its
> already significant.
> Danny, Ludo, WDYT? Could we modify "system-disk-image" to use genimage
> as a backend instead of spawning a VM?

I’m completely sold to the idea.  :-)

Apparently ‘genimage’ supports many file systems, including ext[234] and
ISO9660, which are the two formats we support via ‘--file-system-type’.
It does not support Btrfs, but ‘guix system disk-image’ doesn’t support
it either so far.

Looking at ‘image-ext2.c’ reveals that genimage actually just shells out
to mke2fs.  Indeed, I discovered that ‘mke2fs -d /my/root’ copies
/my/root as the image’s root directory.  Likewise, for ISO, it just
shells out to ‘genisoimage’.

So I think that we could avoid ‘genimage’ altogether and implement
similar functionality for ext4/ISO in (gnu build disk-image).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]