I sometimes get the question if it is possible to boot a virtul machine in XenServer from a USB drive or a stick. Therefore I thought that now is the time to do my first blog entry to show how you can boot a virtual machine from a USB drive.

First of all you need a USB drive which is prepared as a bootable device. For my demo I have used a old 1GB USB stick installed with a Ubuntu 9.10 Live System. To create this stick as a bootable device with all the necessary data on it I used the LinuxLive USB Creator 2.2. This tool makes it very easy to format the USB drive, install a linux distribution on the drive and make the drive bootable.

Once the drive is ready you can attach the USB drive to your physical XenServer. In my case I tried it with XenServer 5.5 Update1 but it also should work with earlier versions of XenServer.

Now I created a virtual machine with a simple standard configuration of CPU, RAM and network and also attached a small disk of 3GB. Take care that the virtual machine is configured to boot from hard disk.



 



Then go to the storage tab of the virtual machine and attach the USB stick. Therefore press the attach button and in the screen comming up select the USB device which is listed under removable storage. Press the attach button.



 



As a result you now can see two disks in the storage tab. But if we want to boot from the USB stick we have to take care that the USB stick is the first drive in all our attached drives. By default after attaching the USB drive it will be the last one in the list of drives which you can also see when you take a look at the device positions.



 



To change the device position select the USB device in the storage tab and press on the properties button. Go to the virtual machine section and change the device position to “0”. If there already is a drive attached at position 0 XenCenter will ask you what to do.



 



In our case we will swap the disks because we only have attached two disks, the USB stick and the local 3GB disk. If you have attached more than one local disk it will be the best to level up the device positions for all attached disk by one to make device position 0 free for the USB stick and then configure the USB stick at device position 0.








Now your virtual machine is ready to boot up from the USB stick. If you start the virtual machine it willcome up with the Ubuntu live system installed on our USB stick.



 



In this example I used a simple Ubuntu disribution to show how to boot a virtual machine from a USB stick but in real there are more use cases to do this. For example a software distribution systems could be configured to boot from a USB stick to connect to the deployment server and do a complete remote install of the operating system. 

Have fun…

          Jens