From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: Use genimage for disk-image creation. Date: Thu, 26 Mar 2020 15:19:04 +0100 Message-ID: <874kub9p2f.fsf@gnu.org> References: <87eetgo9o6.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:35397) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHTLf-0006Kt-KV for guix-devel@gnu.org; Thu, 26 Mar 2020 10:19:09 -0400 In-Reply-To: <87eetgo9o6.fsf@gmail.com> (Mathieu Othacehe's message of "Wed, 25 Mar 2020 14:18:01 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane-mx.org@gnu.org Sender: "Guix-devel" To: Mathieu Othacehe Cc: guix-devel Hi Mathieu! Mathieu Othacehe 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 =3D 0x83 > image =3D "rootfs.ext4" > size =3D 8G > offset =3D 10M > } > } > > image rootfs.ext4 { > name =3D "rootfs" > ext4 { > label =3D "rootfs" > use-mke2fs =3D true > } > size =3D 8G > mountpoint =3D "/" > } > > > and run the command: > > fakeroot genimage --config ~/tmp/genimage.cfg --rootpath=3D/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=E2=80=99m completely sold to the idea. :-) Apparently =E2=80=98genimage=E2=80=99 supports many file systems, including= ext[234] and ISO9660, which are the two formats we support via =E2=80=98--file-system-ty= pe=E2=80=99. It does not support Btrfs, but =E2=80=98guix system disk-image=E2=80=99 doe= sn=E2=80=99t support it either so far. Looking at =E2=80=98image-ext2.c=E2=80=99 reveals that genimage actually ju= st shells out to mke2fs. Indeed, I discovered that =E2=80=98mke2fs -d /my/root=E2=80=99 = copies /my/root as the image=E2=80=99s root directory. Likewise, for ISO, it just shells out to =E2=80=98genisoimage=E2=80=99. So I think that we could avoid =E2=80=98genimage=E2=80=99 altogether and im= plement similar functionality for ext4/ISO in (gnu build disk-image). WDYT? Thanks, Ludo=E2=80=99.