Andrew Stuart
2017-Feb-17 10:15 UTC
[Libguestfs] How to make a Google Compute Engine boot image with guestfish?
wow - guestfish has a dizzying array of options and functionality - looks awesome. I feel a bit like I’m asking for homework help, but perhaps someone might be willing to save me a weekend (or more) of trial and error by pointing me in the right direction….. I’ve done so much fiddling with this sort of stuff that I know a little insider guidance can be a *huge* help and time saver. And if it is considered rude or lazy to ask straight up for help then please accept my apologies and I’ll set out on the grinding road to find the commands that work. Background: I have a zipfile containing a kernel and an initramfs. These are all that is needed to boot an in-memory operating system. I want to put these into an image suitable for booting on Google Compute Engine, using syslinux or extlinux. Google’s requirements for such images are described here (and summarised at the bottom of this email) https://cloud.google.com/compute/docs/images/import-existing-image This is a script that does something very similar what I need (although without an initramfs), but it seems to me that guestfish might be able to do so in a much more straightforward manner: https://github.com/Solo5/solo5/blob/master/tools/mkimage/solo5-mkimage.sh So my question, does anyone know off the top of their head the right incantation to get guestfish to take my kernel and initramfs files and put them into a syslinux/extlinux Google Compute Engine “disk.raw” 10G MBR sparse bootable image, equivalent to the solo5 script above, and compliant with the Google requirements below? I’m hoping that there’s a simple one or two commands to do so. An important constraint is that I will be scripting this and running it on a server that I am not permitted to run “mount” on. thanks heaps! And if I’ve broken etiquette by not first grinding it out before asking, then I apologise. Andrew Requirements To import your boot disks to Compute Engine, your existing boot disks must meet the following requirements: • If you built a custom operating system kernel, it must meet the hardware and kernel configuration requirements. Most stock Linux distributions already meet these requirements, so this requirement is only for advanced users who build their own custom operating systems to run on Compute Engine. • The boot disk must be no larger than 2048GB (2TB). • The boot disk that you import must have a functional MBR partition table or a hybrid configuration of a GPT partition table with an MBR bootloader. • The primary partition on the boot disk can be in any format that you like as long as it boots properly from the MBR bootloader. • The bootloader on the boot disk must not have quiet, rhgb, or splashimage= kernel command line arguments. Compute Engine does not support splash screens on boot. You can remove these values from the GRUB config during the bootloader configuration step. The image file that you import must meet the following requirements: • The disk image file name must be disk.raw. • The RAW image file must have a size in an increment of 1 GB. For example, the file must be either 10 GB or 11 GB but not 10.5 GB. • The compressed file must be a .tar.gz file that uses gzip compression and the GNU tar format.
Richard W.M. Jones
2017-Feb-17 11:14 UTC
Re: [Libguestfs] How to make a Google Compute Engine boot image with guestfish?
On Fri, Feb 17, 2017 at 09:15:09PM +1100, Andrew Stuart wrote:> I have a zipfile containing a kernel and an initramfs. These are all > that is needed to boot an in-memory operating system. I want to put > these into an image suitable for booting on Google Compute Engine, > using syslinux or extlinux.I've not specifically tried it with GCE, but a good starting point might be this Perl script: https://rwmj.wordpress.com/2013/04/04/new-in-libguestfs-use-syslinux-or-extlinux-to-make-bootable-guests/ I skimmed the GCE requirements, and you'll probably need to modify that script a little bit, particularly to make the size be an exact multiple of a gigabyte (currently it uses a fixed 100MB size). Also you'll need to modify it to upload your kernel and initramfs instead of the ones from /boot on the host. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Andrew Stuart
2017-Feb-17 11:45 UTC
Re: [Libguestfs] How to make a Google Compute Engine boot image with guestfish?
Thanks Richard. I am not able to perform a mount on the machine that I’ll be building this image on. Is there a way for me to copy the files into the image without doing a mount - as the perl script appears to do at this point: $g->mount ("/dev/sda1", "/"); thanks
Maybe Matching Threads
- How to make a Google Compute Engine boot image with guestfish?
- Re: How to make a Google Compute Engine boot image with guestfish?
- Displaying mountables in the error output of guestfish etc
- Re: Extlinux with guestfish
- Re: Mounting disk images with ext2 filesystems on RHEL7