Tool to create sparse debian based disk images for virtual hosts
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


vdisk is a tool to create a debian system suitable for use by a
virtualization technology such as kvm/qemu. The output image is
is a sparse file containing a partition table, a boot loader (grub)
and a partition with the base system.

vdisk builds a sparse image and mounts it to a loopback device for convenient
This allows for easy manipulation of these inside of a chroot,
effectively allowing for bootstrapping a virtual base system without having to
fire up a virtual machine.


vdisk is designed to run in Debian GNU/Linux and the standard
configuration builds a Debian Squeeze image.

vdisk depends on a few packages being installed on the system where
images are built. This can be accomplished by running the following

    apt-get install kpartx parted lvm2 python-argparse


All of the following commands must be run as root on a linux host.

vdisk expects a configuration file in the current working directory called
vdisk.yaml, an example should be distributed with this package.

Build a fresh image and bootstrap a base system to it.

    bin/vdisk foo.img create
    bin/vdisk foo.img bootstrap

Install required packages, and prepare image for booting.

    bin/vdisk foo.img install [selections]

Try it out.

    bin/vdisk foo.img enter

When you have a successfully installed a system, try it out using a virtual
machine or an emulator like qemu.

    qemu-system-x86_64 -hda foo.img -monitor stdio


You must include /boot/grub/menu.lst  it in your vdisk.yaml. Simple example:

default 0
timeout 3
title EC2
root (hd0,0)
kernel /vmlinuz root=/dev/mapper/VolFoo-root ro
initrd  /initrd.img

Depending on your kernel you might also need to create
/etc/initramfs-tools/modules with xenblk and xennet modules, vdisk will execute
update-initramfs as the final step.

Important Files

vdisk.yaml - Contains configuration for how to create your virtual disk.
             This should be recreated in your project and modified to suit your needs.

License & Credits

This software is released under the Apache 2 license, see LICENSE.txt for details.

It is authored by John-John Tedro <>,
Noa Resare <> and Lars-Erik Stenholm <>.

Copyright is held by Spotify AB.