Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have written a script that generates a root filesystem image (based on Debian lenny) suitable for User-Mode Linux. (Essentially this script creates a filesystem image, mounts it with a loop device, uses debootstrap to create a lenny install, sets up a static IP for TUN/TAP networking, adds public keys for login by SSH and installs a web application.)

These filesystem images work pretty well with UML, but it would be nice to be able to generate similar images that people can use on alternative virtualization software, and I'm not familiar with these options at all. In particular, since the idea is to use this image as a standalone server for testing the web application, it's important that the networking works.

I wonder if anyone can suggest what would be involved in customizing such root filesystem images such that they could be used with other virtualization software, such as VMware, Xen or as an Amazon EC2 instance? Two particular concerns are:

  • If such systems don't use a raw filesystem image (e.g. they need headers with metadata or are compressed in some particular way) do there exist tools to convert between the different formats?

  • I assume that in the filesystem, at least /etc/network/interfaces will have to be customized, but are more involved changes likely to be necessary?

Many thanks for any suggestions...

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

VirtualBox has "VBoxManage convertdd" to import raw disk images (generated with dd) into its own special .vdi format. I believe there are similar things for VMWare etc.

The various virtualisation products often have some kernel extensions (like the VirtualBox Guest Extensions) which enable the guest operating system to co-operate with the host in various ways, which it's often helpful to have installed.

The Open Virtualization Format (OVF) seems to be gathering support - see http://en.wikipedia.org/wiki/Open_Virtualization_Format for an introduction.

share|improve this answer
    
Thanks, Dominic, for the helpful information. –  Mark Longair Mar 4 '10 at 15:40
add comment

One another way, might be attaching partition directly.

In qemu it's just at command line.

At VirtualBox you have to follow steps like described in VirtualBox user manual chapter 9 - subsection "Advanced storage configuration" : http://www.virtualbox.org/manual/ch09.html#id504534 what looks more or less like this:

VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda
VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -register
VBoxManage storageattach MyVM --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /path/to/file.vmdk

of course /dev/sda can be changed to any block device, especially partition (maybe on LVM2).

On VMWare there is also possibility of attaching partition or disk directly.

Thanks to that, in such configuration you can even switch from one VM to another, using the same installation.

share|improve this answer
    
Btw. In case of VirtualBox, I presonally lounched only one command (in order to connect my LVM2 partition - of course setup priviledes to partition (chown): "VBoxManage internalcommands createrawvmdk -filename /home/.../partition.vmdk -rawdisk /dev/mapper/vg0-VMData -register" And done rest from VirtualBox GUI. –  Grzegorz Wierzowiecki Jan 4 '11 at 0:44
add comment

Are you aware of this root filesystem site? All the filesystems on there were originally developed for use with UML, but they should work with any virtualization solution. Note however that there is no bootloader installed as the images are made of a single loop mounted disk (without a partition table). You can still boot them with kvm using its -kernel command line option, for the others you will need to boot another image (recovery cd/image perhaps?) and install the bootloader yourself. Obviously you may have to convert this raw format into whatever format you need (vdi/vmware/..) using the relevant tools. The scripts are included should you want to create the filesystems yourself.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.