VMLite VBoot - Linux VHD Boot

updated on Mar-31-2011

Copyright 2011, VMLite Inc.

1 Overview

1.1 Linux as Real Appliance

With VBoot for Linux, you can pre-install and pre-configure Linux OS and its applications, then distribute the resulting virtual disk file in VHD format. The vhd can boot a real computer, with configuration and apps instantly available. This way, operating systems are truly manageable, as simple as files. We call such a Linux VHD to be a real appliance, in the sense that it boots physical computers.

It's very easy to setup and boot a computer with a vhd file. You download the vhd file, drop it to Windows or Linux file system, then configure the boot loader, and reboot the computer.

1.2 Linux as Virtual Appliance

The exact same vhd file also runs as a virtual machine using virtualization software, such as VMLite Workstation, VirtualBox, Xen and Virtual PC and Hyper-V, etc. By default, it's optimized for VMLite Workstation.

If VMLite Workstation is installed, you can simply double click the ubuntu-1010-desktop-i386.mop file to launch the vhd as a virtual machine with VMLite Workstation.

1.3 USB Boot Made Easy

You just need to store the vhd file to usb drive, then hook the USB to different computers to boot. If your computer BIOS does not support USB boot, you need to configure GRUB2 to support USB.

1.4 The sample Ubuntu VHD

The sample  ubuntu-1010-desktop-i386.vhd is a pre-installed 32-bit Ubuntu 10.10 desktop version in English.

2 System Requirements

3 Download and Extract

The sample Ubuntu 10.10 package is a few hundred MB, so it will take quite some time to download, and it's recommended to use a download manager, such as FlashGet.

Once download is complete, first you need to extract the file, which is in .7z format. More info can be found at http://www.7-zip.org/download.html. On Windows, you can use WinRar or 7Zip to extract the file. On Linux, you can use the following commands to install 7zip, and unzip the file:

    sudo apt-get install p7zip

    p7zip -d ubuntu-1010-desktop-i386.7z

In order to boot a computer using the vhd file, make sure that it's not extracted to a network drive, or to another virtual disk. The vhd file must reside in a basic volume on internal or external hard disks (e.g., USB drives), otherwise, it won't boot.

4 Install on Windows

You need to download and install VBoot for Windows first, then add a boot entry to grub.cfg file to boot the Linux VHD file.

4.1 Download and Install VBoot For Windows

In order to boot a Linux virtual disk, you need to install our VBoot Loader. Please read Section 1 and 2 of this document http://www.vmlite.com/vboot/instructions.html

4.2 Configure grub.cfg file

A grub.cfg file is placed in c:\vboot\grub directory (or d:\vboot\grub depending on where you have copied the files). This is the GRUB2 configuratrion file to load operating systems. Inside this file, the vhd file path is hard coded, and thus you have to modify it.

grub.cfg is a text file that you can use notepad to open and modify. The relevant portion is shown below:

menuentry "VHD Ubuntu, Linux 2.6.35-28-generic" {
	insmod vhd
	vhd vhd0 (hd0,1)/ubuntu-1010/ubuntu-1010-desktop-i386.vhd --partitions
	linux (vhd0,1)/boot/vmlinuz-2.6.35-28-generic root=/dev/sda1 vloop=/ubuntu-1010/ubuntu-1010-desktop-i386.vhd vlooppart=p1 quiet splash
	initrd (vhd0,1)/boot/initrd.img-2.6.35-28-generic
}

menuentry groups a specific operating system. The first line insmod vhd inserts our vhd.mod module to the boot loader. vhd.mod is a GRUB2 module that treats a vhd file as hard disk, and allows GRUB2 to read files from the vhd. For example, the Linux kernel and initrd are loaded from the vhd file, as configured above.

There are three paths (as shown in red) related to the vhd file that you need to change depending on the directory to which the vhd file is extracted.

The vhd path (hd0,1)/ubuntu-1010/ubuntu-1010-desktop-i386.vhd is in GRUB2 format where (hd0,1) indicates hard disk 0 and partition 1, with the rest is the absolute path in UNIX format. For example, if your vhd file is inside a folder called 123 on an external USB disk, then you need to change this path to something like (hd1,1)/123/ubuntu-1010-desktop-i386.vhd. The path immediately after vloop= should be the same absolute path without the disk number and partition number.

The root path is the Linux device name for the disk where the vhd file resides. The number is the partition number, and the letter 'a', 'b', 'c', etc, represents which disk. For (hd0,1), the name would be /dev/sda1; For (hd1,1),  it would be /dev/sdb1; For (hd2,4), it would be /dev/sdc4, etc.

5 Install on Linux

On Linux systems, there is no need to install VBoot Loader. Instead, you only need to add an entry to your current boot loader so the Linux VHD can be booted.

5.1 Configure GRUB2

You can edit the GRUB2 config file, /boot/grub/grub.cfg, using any text editor, and insert an entry like the following:

menuentry "VHD Ubuntu, Linux 2.6.35-28-generic" {
	linux (hd0,1)/ubuntu-1010/vmlinuz-2.6.35-28-generic root=/dev/sda1 vloop=/ubuntu-1010/ubuntu-1010-desktop-i386.vhd vlooppart=p1 quiet splash
	initrd (hd0,1)/ubuntu-1010/initrd.img-2.6.35-28-generic
}

There are some subtle differences between Linux and Windows host. On Windows where our GRUB2 module,vhd.mod, is available, you can configure GRUB2 to load the Linux kerenl and initrd from the exactly same vhd file, whereas on Linux systems, the kernel and initrd are separate files residing externally. In other words, on Windows, it's strictly only one vhd file is required; whereas on Linux, 3 files (kernel, initrd, vhd) are required. We will try to make the vhd.mod module to support Linux file system soon.

Obviously, you need to change the paths depending on the directory to which the kernel, initrd and vhd files are extracted.

The path (hd0,1) indicates hard disk 0 and partition 1, with the rest is the absolute path in UNIX format. For example, if your vhd file is inside a folder called 123 on an external USB disk, then you need to change this path to something like (hd1,1)/123/ubuntu-1010-desktop-i386.vhd. The path immediately after vloop= should be the same absolute path without the disk number and partition number.

The root path is the Linux device name for the disk where the vhd file resides. The number is the partition number, and the letter 'a', 'b', 'c', etc, represents which disk. For (hd0,1), the name would be /dev/sda1; For (hd1,1),  it would be /dev/sdb1; For (hd2,4), it would be /dev/sdc4, etc.

5.2 Configure Legacy GRUB

For GRUB 0.97 and similar, you can add an entry to your GRUB config file, /boot/grub/menu.lst, using any text editor, and insert an entry like the following:

title	VBoot - Ubuntu VHD Boot
kernel  /boot/ubuntu-1010/vmlinuz-2.6.35-28-generic root=/dev/sda1 vloop=/boot/ubuntu-1010/ubuntu-1010-desktop-i386.vhd vlooppart=p1 quiet splash
initrd  /boot/ubuntu-1010/initrd.img-2.6.35-28-generic
quiet    

Obviously, you need to adjust the paths according to your own locations for the Linux kernel, initrd and vhd file.

5.3 Configure other Boot Loaders

We haven't tested other Linux boot loaders, such as LILO and SYSLINUX, but they may work as well. The important thing is to add vloop= argument to the Linux kernel line:

     root=/dev/sda1 vloop=/boot/ubuntu-1010/ubuntu-1010-desktop-i386.vhd vlooppart=p1

The above tells where to locate the vhd file.

6 Making your own Linux VHD File

If you want to make your own Linux VHD file to boot, right noow you can do so only if your Linux kernel version is compatible with Ubuntu 9.10, 10.04 or 10.10. After we release the source code, you can create VHDs by yourself for all Linux kernel versions.

Follow the following steps:

1) Download and install VMLite Workstation.

2) Create a VHD virtual disk file, for example, you can run the following command to create a vhd file with disk capacity of 100G:

    vbootctl.exe createhd ubuntu-1010-desktop-i386.vhd /size 100

3) Create a vm, attach the VHD file created from step 2), boot the vm using Ubuntu 10.10 32-bit CDROM, and install Ubuntu inside the vm.

3) After the VHD is ready, you download an initrd file from us, and you will be able to boot the vhd.