b9-0.3.1: A tool and library for building virtual machine images.

Safe HaskellNone



Data types that describe all B9 relevant elements of virtual machine disk images.



data ImageTarget Source

Build target for disk images; the destination, format and size of the image to generate, as well as how to create or obtain the image before a VmScript is executed with the image mounted at a MountPoint.

data ImageDestination Source

The destination of an image.


Share String ImageType ImageResize

Create the image and some meta data so that other builds can use them as ImageSources via From.

LiveInstallerImage String FilePath ImageResize

DEPRECATED Export a raw image that can directly be booted.

LocalFile Image ImageResize

Write an image file to the path in the first argument., possible resizing it,


Do not export the image. Usefule if the main objective of the b9 build is not an image file, but rather some artifact produced by executing by a containerize build.

data ImageSource Source

Specification of how the image to build is obtained.


EmptyImage String FileSystem ImageType ImageSize

Create an empty image file having a file system label (first parameter), a file system type (e.g. Ext4) and an ImageSize

CopyOnWrite Image


SourceImage Image Partition ImageResize

Clone an existing image file; if the image file contains partitions, select the partition to use, b9 will extract that partition by reading the offset of the partition from the partition table and extract it using dd.

From String ImageResize

Use an image previously shared by via Share.

data Partition Source

The partition to extract.



There is no partition table on the image

Partition Int

Extract partition n n must be in 0..3

data Image Source

A vm disk image file consisting of a path to the image file, and the type and file system.

data ImageResize Source

How to resize an image file.


ResizeImage ImageSize

Resize the image but not the file system. Note that a file system contained in the image file might be corrupted by this operation. To not only resize the image file but also the fil system contained in it, use Resize.

Resize ImageSize

Resize an image and the contained file system.


Resize an image and the contained file system to the smallest size to fit the contents of the file system.


Do not change the image size.

type Mounted a = (a, MountPoint) Source

imageFileExtension :: ImageType -> String Source

Return the file name extension of an image file with a specific image format.

data SharedImage Source

SharedImage holds all data necessary to identify an image shared. Shared images are stored in Repositorys.


Eq SharedImage 
Ord SharedImage

Shared images are orderd by name, build date and build id

Read SharedImage 
Show SharedImage 

siName :: SharedImage -> String Source

Return the name of a shared image.

sharedImageImage :: SharedImage -> Image Source

Return the disk image of an sharedImage

sharedImageFileName :: SharedImage -> FilePath Source

Calculate the path to the text file holding the serialized SharedImage relative to the directory of shared images in a repository.