Creating OS Images

There are two types that are supported for deploying images.

  • tarball
  • dump

Tarball

Tarball based images are quite simply a tarball of a working system. A good example use case for this is deploying a Gentoo instance using a stage4 tarball. The only requirement is that the tarball is gzipped instead of bzip2 for speed. If you wish use a kernel inside of the VM instead of externally, make sure that a working kernel and grub config are installed in the tarball. Enable the grub custom script to install the grub boot image during installation.

Dump

The most efficient type of disk image is creating filesystem dumps using the dump command. The advantage with using dumps is that its much faster to deploy using it, and it also has built-in compression. The disadvantage is that you need to install grub manually which might be an issue on some operating systems. We currently fully support grub 1 and have partial support with grub2. After the new instance has booted, you will need to run update-grub and reboot the VM to get the new settings. We currently cannot run update-grub during the install because of an upstream grub2 issue.

You will need to create images for both the boot and root partition (if you include a boot partition).

Create a base image for an instance just like its described in Qemu Images. Make sure the instance is shutdown and then issue the following commands (assuming the activated disk is drbd1)::

dump -0 -q -z9 -f ${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}-boot.dump /dev/mapper/drbdq-1
dump -0 -q -z9 -f ${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}-root.dump /dev/mapper/drbdq-3

Partition Layout

Currently the partition layout is locked into a specific way in order to make it work more elegantly with ganeti. We might change this to be more flexible in the future, however for now you must use the following layout otherwise ganeti will not install the VM correctly. Currently the following partition layout is assumed:

With swap

/dev/$disk1    /boot
/dev/$disk2    swap
/dev/$disk3    /

Without swap

/dev/$disk1    /boot
/dev/$disk2    /

NOTE: If you have kernel_path set, /boot will not be created and all partition numbers will go up by one. For example:

With swap

/dev/$disk1    swap
/dev/$disk2    /

Without swap

/dev/$disk1    /

Image Naming

The naming convention that is used is the following:

tarball:    $IMAGE_NAME-$ARCH.tar.gz
dump:       $IMAGE_NAME-$ARCH-boot.dump
            $IMAGE_NAME-$ARCH-root.dump

Useful Scripts

There are a set of useful scripts located in /usr/share/ganeti/os/image/tools that you are welcome to use. These scripts are all intended to be run on the master node.

mount-disks $instance_name
umount-disks $instance_name

This will mount or umount an instance to /tmp/${instance_name}_root

make-dump $instance_name [ $IMAGE_DIR ]

Create dump images for the given OS variant. You can override the default $IMAGE_DIR setting of /var/cache/ganeti-instance-image/ by giving it as a second argument.