Disk image creation with Oz

The Oz tool allows an automatic disk image creation working on Linux OS. Virtual machines or physical hosts can be used for the process.


  • create JEOS (just enough operating system) guests with minimal input.
  • need KVM + Libvirt.
  • use a predefined set of kickstart/preseed file.
  • working on VM.


  1. Download the installation media.
  2. Generate an automated installation file (e.g. kickstart, preseed, etc).
  3. Generate a modified installation media that includes the installation file.
  4. Run the native installer in a KVM (or Qemu) guest.
  5. At the end of installation, shutdown the guest.


  • Linux packages:
$ yum install oz libguestfs-tools virt-manager virt-viewer eog

Configuration files

Configuration files for CentOS 6.

  • Oz configuration:
output_dir = /var/lib/libvirt/images
data_dir = /var/lib/oz
screenshot_dir = /var/lib/oz/screenshots
# sshprivkey = /etc/oz/id_rsa-icicle-gen

uri = qemu:///system
image_type = raw
#type = kvm
bridge_name = virbr0
cpus = 1
memory = 1024

original_media = yes
modified_media = no
jeos = no

safe_generation = no
  • Oz TDL (template definition language):

A simple XML type file.

 <description>CentOS 6 Server x86_64</description>
  <install type='iso'>

Kickstart/Preseed files

  • Kickstart:

Automatic installation file for Red Hat family.


# Use network installation
url --url ""

# Additional repositories
# Install epel-release package from
repo --name="extras" --baseurl=

# Install stratuslab-contextualization package from
repo --name="StratusLab" --baseurl= --cost=5000


# Packages
%packages --nobase --ignoremissing
  • Preseed:

Automatic installation file for Debian family.

#### Contents of the preconfiguration file

### Localization
d-i debian-installer/locale string en_US

# Keyboard selection.
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us


### Finishing up the installation
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note

Oz commands

  • Disk image creation:
$ oz-install -d 3 -t 10000 -p -c ~/Oz/oz.cfg -x centos6.xml -a centos.ks -u oz.tdl 
  • Check the disk image state:
$ eog /var/lib/oz/screenshots/CentOS-6-Server-x86_64-*.ppm