Skip to content

New Installer: Kiwi Image Deployment

Ladislav Slezák edited this page Oct 16, 2013 · 1 revision

KIWI / Studio Image Deployment

This document describes the essential parts about pre-built KIWI images used by the installer during the deployment step.

Image Types

1. Live image

A live system image is a hard disk of the system with the restriction that you can’t write data on it. So as soon as the media is plugged into the computer, the machine is able to boot from that media. After boot one can login to the system and work there as in a regularly installed system. All write actions take place in RAM space and therefore all changes will be lost as soon as the computer shuts down or reboots. This image can be shipped on CD, DVD or USB stick. There are several flavours of live images (split, hybrid, oem, oem compressed)

2. Disk image

Virtual system that can be used in Xen, VMWare, Amazon EC2, KVM and other virtual environments. A special flavour is OEM / preload image which is a virtual disk image representing all partitions and bootloader information in the same fashion as it exists on a physical disk. There is a small system which deploys the image to the target system after booting the medium.

KIWI image build process follows the user configuration stored in the config.xml file. This file is available in the directory /image within the image file system after the build has finished.

Image Deployment Tools

Considered is local real hardware deployment only.

The virtual disk image created by KIWI can be tested using virtualization software such as QEMU, VMware, or VirtualBox. The virtual disk is represented by a file with the .raw extension.

The raw image disk can be mounted locally. To mount all the partitions in a raw disk image:
zypper install kpartx
kpartx -av disk_image.raw

This will output lines such as:
loop0p1 : 0 20964762 /dev/loop0 63

The loop0p1 is the name of a device file under /dev/mapper which you can use to access the partition, for example to fsck it:
fsck /dev/mapper/loop0p1

We can mount this image:
mount /dev/mapper/loop0p1 /mnt/mount_point

When we are done, you need to unmount and remove the devices:
umount /mnt/mount_point
kpartx -d disk_image.raw

KIWI or SUSE Studio is capable of creating several formats of disk images according to the needs of the user. The main types are listed below:

raw image

Deploying the image on the hard disk is quite straightfoward:
dd if=image.raw of=/dev/device bs=32k

vmx image

A VMX image is a virtual disk image for use in full virtualization systems. The generated virtual disk image serves as the hard disk of the selected virtualization system. The virtual hard disk format differs across virtualization environments. Some virtualization environments support multiple virtual disk formats. KIWI always generates a file in the .raw format. The .raw file is a disk image with a structure equivalent to the structure of a physical hard disk. Supported disk formats:

  • vmdk - Disk format for VMware

  • vhd - Disk format for Microsoft HyperV

  • ovf - Open Virtual Format

  • qcow2 - QEMU virtual disk format

We would need to convert these disk formats to a .raw format before mounting. The vendors who support these image formats have their own tools for converting them, however there is a free tool available for converting those formats into the raw format:

zypper install qemu-linux-user
zypper install qemu-tools
qemu-img convert -O raw disk_image.vmdk|vhd|qcow diskimage.raw

After the image has been converted into raw format, we can follow the steps as described at the beginning of this section.

Or we can even convert and deploy the image directly to a device at once:

qemu-img convert -f host_device /dev/disk -O qcow2 disk_image.gcow2

xen image

A Xen image is a virtual disk like a vmx but with the xen kernel installed.

zypper install xen kernel-xen xm create -c xen-image-path/ the-file-with-suffix.xenconfig