How to boot a virtual machine image from the network

virtual-machines

I have many machines which require the same configurations. My goal is to boot them all from the network and load a virtual machine. It would be wonderful to have one image for all of our customer service machines. That way, I could load the virtual image, perform updates, and know the next time they boot up they will have all the changes. Ideally, the machines would store the image locally and only download a new image if there has been a change.

With all the information out there on "desktop virtualization", "PXE booting", and "virtual machines", I feel lost. I have been reading for hours and feel like I have only just scratched the surface.

I would like to do this using open source or free software. Any suggestions?

Best Answer

You are combining two things: (1) diskless booting which is common in HiPC clusters, where tools like compilers, libraries, etc, are stored on a clustered file system like Lustre or NFS; (2) virtual disk images (vmdk or vdi, or whatever else).

In case (1), you need a tftp server and a dhcp server, along with a modified initrd image for customized drivers, scripts, etc.

http://www.pixelchaos.net/2009/02/15/diskless-booting-with-pxe-and-nfs/

In case (2), given all machines are same, including configurations, you can nfs mount the virtual disk image. Write a script that checks for any changes like whether the existing image is same as nfs mounted; if they are not same, copy this image to boot partition and reboot it. You need to add this script in initrd. You can play with that.

http://www-conf.slac.stanford.edu/afsbestpractices/Slides/afsboot.pdf

The paper above gives you some clues. You better focus on how the whole boot process works, etc.

If you are using ESXi, there is a better way to achieve what you want: export nfs to esxi hosts. Keep the vmdk and -flat.vmdk files on the nfs server, and change vmdk location in .vmx file. During the next boot, it picks up your new image.

Related Topic