[ubuntu-cloud] How are Ubuntu images built?

Scott Moser smoser at ubuntu.com
Mon Nov 22 12:03:24 GMT 2010

On Sat, 20 Nov 2010, Spike Spiegel wrote:

> On Sat, Nov 20, 2010 at 1:16 AM, Scott Moser <smoser at ubuntu.com> wrote:
> > vm-builder does it more like:
> >  * create a root filesystem
> >  * install certain packages in it (cloud-init, legacy-grub-ec2,
> >   openssh-server... the 'uec' task)
> >  * copy root filesystem to loopback image
> how is this image created? like a dd if=/dev/zero ... ? Does it get
> partitioned? What's with this piece of code that I've found in several
> places (this comes from build-ec-image , automate-ec2-builds):
> if [ "${arch}" = "i386" ]; then
>                 printf "%s\n%s\n%s\n" "root ${size} a1" \
>                         "/mnt 1 a2" "swap 1024 a3"
>         else
>                 printf "%s\n%s\n" "root ${size} a1" "/mnt 1 b"
>         fi

ec2 gives 3 different partition layouts, vmbuilder is just attempting to
write a fstab that matches.  Note, I don't use that code any longer as I
supply my own partition map (see automated-ec2-builds/build-ec2-image in
the 'cat_partfile' function).

i386 instances look like:
  sda1: root
  sda2: ephemeral0 (160G)
  sda3: swap (2G maybe? i dont' remember off the top of my head).

amd64 instances look like:
  sda1: root
  sdb: ephemeral0 (160G)

t1.micro instances (amd64 or i386) have no ephemeral or swap.

> why x86_64 has no swap? and the /mnt is only to mount ephemeral and
> get access to the keypair?

This is amazon decision, its just the disk layout the instance has.

> >  * run some "fixups" (vmbuilder-uec-ec2-fixes)
> >
> > I'm not sure about hwclock.
> I just mentioned because I noticed this in the ec2 plugin:
> self.context.distro.disable_hwclock_access()
> > grub2 installation wont help you with the
> > pv-grub kernel, as it reads only a grub1 (0.97) menu.lst file.
> >
> > The UEC images have both grub2 and legacy-grub-ec2 installed so that they
> > can use either loader (grub2 on kvm or hvm or virtual-box ...).
> uhm, this part still confuses me, but I'll pick it up in the other
> thread, in fact maybe we should even consolidate them for the sake of
> clarity.

Well, grub2 is not going to maintain writing a menu.lst file (at least I
would not think they would want that, as *that* would be confusing).  This
solution allows us to use grub2 everywhere except for the 1 location where
we *can't*, as there is no pv-grub2.

More information about the Ubuntu-cloud mailing list