Saturday, March 10, 2012

Multiboot ESXi 5, Windows 2008 R2, RHEL 6, XenServer 6

Congratulations, you decided to be the ultimate hypervisor egalitarian and install every mainstream hypervisor + KVM onto a single server.  You setup Windows 2000 and Redhat to dual boot 11 years ago, how much can things have changed?

I could have accomplished this project via constantly swapping harddrives when I needed to change hypervisors, but that seemed more like accepting the problem than a solution.

My initial plan was to divide my six harddrives into 4 logical volumes at the raid controller level.  Unfortunately the raid controller for servers I was using (I'm going to refrain from plugging any one vendor, at least as long as I'm operating on other people's hardware) doesn't provide this functionality.  For a brief moment I flirted with the idea of cutting up the disk using partitions, until a closer look at ESXi and Xen's installation revealed they don't provide any granularity in setup of the partition tables beyond selecting an installation volume.

Instead of telling this story as it happened, I'm going to first go over the hiccups I encountered on the way.  That way, incase you're like me and already started this project before doing your research, you can plan a bit before reading the whole article.

VMware Boot Bank Corruption
Not sure how I accomplished this on the first server, because I couldn't replicate it on the second.  I assumed it was because Microsoft was automounting the VMware Boot Banks (they are formatted fat32).  Anywho, for quite a long time I was stuck with the error "Not a VMware Boot Bank".  VMware provides very little information on this error (and not applicable to my situation).  Unfortunately VMware also doesn't seem to provide a way to fix a corrupted Boot Bank, so I was forced to reinstall.  Afterwards I ran this command to prevent Windows from auto-mounting these volumes:

automount disable

Windows installing onto the wrong drives
While Microsoft is nice enough to ask you which drive you'd like to install Windows on, that doesn't mean it'll listen.  Unfortunately while it will install your C: drive to the selected partition, it will install the 100MB System Reserved partition which it boots from to where it sees fit.   On a system with lots of unformatted drives like mine, and where I was installing Windows to not the first volume, it chose to put the system reserved partition and the MBR for windows on the first volume set, ensuring that it would be booted automatically.  I ended up fixing this by only leaving in the disks for Windows during it's installation process, then inserting the other disks after it was done.

XenServer is scared of VMFS volumes
Citrix, it's ok to be scared, but you need to face your fears.  Every time I booted the Xen installer it would die when it got the point of scanning the drives with the error "Could not parse Sgdisk".  From what I found via a quick google, this is due to an inability of the Xen 6 installer to handle VMFS volumes.  Citrix, this is no way to convert followers away from VMware.  I resolved this by making sure the disk I was installing Xen to was formatted and pulling the other disks out of the server during the installation of XenServer.

XenServer is scared of GPT volumes
Not sure if this was just from me, or why this was occuring, but I had to follow these instructions to get past a GPT error which occurred during the installation of Xen 6:

1. Boot from the XenServer 6.0.0 install CDROM.
2. At the Xen 6.0.0 install prompt type menu.c32 and press enter.
3. When you get the new menu screen press TAB
4. add disable-gpt just before the last --- then press enter.

BCDedit won't modify the configuration if it's not the primary disk
I promoted this to its own blog post.

The actual project
For these four hypervisors, there are three different boot loaders used, and two major versions of one of those boot loaders:

Windows 2008 R2Bootmgr
RedHat Enterprise LinuxGrub
VMware ESXi 5Syslinux 3.86
Citrix XenServer 6Syslinux 4.04

My original goal was to use Grub with RHEL 6 to load everything else.  This turned out to be a much simpler task than the hours of time I burned on it made it appear.  I thought the errors I was receiving in ESXi due to a corrupted boot bank were from some problem with Grub chainloading Syslinux, turns out i had really just corrupted my boot bank.

Boot everything from Grub
This turned out to be rather simple due to support for something called "chainloading".  My final working grub configuration is:

# grub.conf generated by anaconda
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_ccskvmvmh01-lv_root
#          initrd /initrd-[generic-]version.img
title Red Hat Enterprise Linux (2.6.32-220.el6.x86_64)
 root (hd0,0)
 kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=/dev/mapper/vg_ccskvmvmh01-lv_root rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto rd_NO_DM rd_LVM_LV=vg_ccskvmvmh01/lv_root rd_LVM_LV=vg_ccskvmvmh01/lv_swap
 initrd /initramfs-2.6.32-220.el6.x86_64.img
title Windows 2008 R2
 rootnoverify (hd1)
 chainloader +1

title ESXi 5
 rootnoverify (hd2)
 chainloader +1

title XenServer 6
 rootnoverify (hd3)
 chainloader +1

Grub simply hands off booting to the MBR on the respective drives, and the boot loaders for the other hypervisors takes it from there.

Of course since this didn't initially work for me, I went through all the additional effort to also make this for from ESXi's and Xen's Syslinux to boot everything, and I made an effort (but did not finish) making Bootmgr boot everything else.

Boot everything from ESXi 5 (Syslinux 3.86)
This works pretty much the same way, with two major caveats.  First, VMware was not nice enough to ship menu.c32 or chain.c32 with the installation of ESXi 5.  Therefore you need to go here, download Syslinux 3.86 and extract those two files.

Second, ESXi doesn't mount it's first partition, so you can't do any of this from within ESXi's console.  I'd recommend a linux boot disk, or if you chose to dual boot with RHEL 6, you can mount it from there.  You'll know you have the right partition if you see the files:


Copy chain.c32 and menu.c32 into this partition.  Now backup syslinux.cfg and replace it with the following:

ui menu.c32

label esxi
menu label ESXi 5
COM32 safeboot.c32

label win
menu label Windows 2008 R2
COM32 chain.c32

label xen
menu label XenServer 6
COM32 chain.c32

label linux
menu label RedHat Enterprise 6
COM32 chain.c32
Pretty simple.

Boot everything from Xen 6 (Syslinux 4.04)
Citrix was nice enough to include both menu.c32 and chain.c32 in their boot partition.  I didn't check to see if they mounted this within their OS or not, and simply edited it out of band anyways.  Since I was already done with most everything at this point, I didn't change it to use the menu config but instead left it with requiring you to enter the label at the boot prompt.

The file you want to edit this time is extlinux.conf.  Again, I suggest making a backup first:

# location mbr
serial 0 115200
default xe
prompt 1
timeout 50

label xe
  # XenServer
  kernel mboot.c32
  append /boot/xen.gz dom0_mem=752M lowmem_emergency_pool=1M crashkernel=64M@32M console= vga=mode-0x0311 --- /boot/vmlinuz-2.6-xen root=LABEL=root-ckxrtmdk ro xencons=hvc console=hvc0 console=tty0 quiet vga=785 splash --- /boot/initrd-2.6-xen.img

label xe-serial
  # XenServer (Serial)
  kernel mboot.c32
  append /boot/xen.gz com1=115200,8n1 console=com1,vga dom0_mem=752M lowmem_emergency_pool=1M crashkernel=64M@32M --- /boot/vmlinuz-2.6-xen root=LABEL=root-ckxrtmdk ro console=tty0 xencons=hvc console=hvc0 --- /boot/initrd-2.6-xen.img

label safe
  # XenServer in Safe Mode
  kernel mboot.c32
  append /boot/xen.gz nosmp noreboot noirqbalance acpi=off noapic dom0_mem=752M com1=115200,8n1 console=com1,vga --- /boot/vmlinuz-2.6-xen nousb root=LABEL=root-ckxrtmdk ro console=tty0 xencons=hvc console=hvc0 --- /boot/initrd-2.6-xen.img

label fallback
  # XenServer (Xen 4.1.1 / Linux
  kernel mboot.c32
  append /boot/xen-4.1.1.gz dom0_mem=752M lowmem_emergency_pool=1M crashkernel=64M@32M --- /boot/vmlinuz- root=LABEL=root-ckxrtmdk ro xencons=hvc console=hvc0 console=tty0 --- /boot/initrd-

label fallback-serial
  # XenServer (Serial, Xen 4.1.1 / Linux
  kernel mboot.c32
  append /boot/xen-4.1.1.gz com1=115200,8n1 console=com1,vga dom0_mem=752M lowmem_emergency_pool=1M crashkernel=64M@32M --- /boot/vmlinuz- root=LABEL=root-ckxrtmdk ro console=tty0 xencons=hvc console=hvc0 --- /boot/initrd-

label redhat
com32 chain.c32
append hd0

label win
com32 chain.c32
append hd1

label esxi
com32 chain.c32
append hd2

Boot everything from Bootmgr
First note, I never actually go this working.  Booting Grub from Bootmgr is easy.  I'm sure it's possible somehow to boot Syslinux from Bootmgr, but after accomplishing the above tasks this seemed like a trivial exercise.  Still, I figured I'd list what I did.

First I pulled the mbr off each of the disks:

dd if=/dev/sda of=/tmp/linux.bin bs=512 count=1
dd if=/dev/sdc of=/tmp/syslinux.bin bs=512 count=1
dd if=/dev/sdd of=/tmp/xen.bin bs=512 count=1

Then I copied the files I created to the root of the C: drive for Windows.  Then within BCD edit I ran:

bcdedit /create /d “Linux” /application BOOTSECTOR
bcdedit /set {ID} device partition=c:
bcdedit /set {ID}  path \linux.bin
bcdedit /displayorder {ID} /addlast

bcdedit /create /d “ESXi 5” /application BOOTSECTOR
bcdedit /set {ID} device partition=c:
bcdedit /set {ID}  path \syslinux.bin
bcdedit /displayorder {ID} /addlast

bcdedit /create /d “Xen 6” /application BOOTSECTOR
bcdedit /set {ID} device partition=c:
bcdedit /set {ID}  path \xen.bin
bcdedit /displayorder {ID} /addlast

bcdedit /timeout 30
{ID} should be replaced in each entry here by the ID which BCDedit gives you for that entry after you run the /create command.   When I was finished the configuration looked like this:

Windows Boot Manager
identifier              {bootmgr}
device                  partition=E:
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
default                 {default}
resumeobject            {69db61ae-5dc5-11e1-8bc1-bb2a8301fdf5}
displayorder            {default}
toolsdisplayorder       {memdiag}
timeout                 10

Windows Boot Loader
identifier              {default}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Windows Server 2008 R2
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {69db61b0-5dc5-11e1-8bc1-bb2a8301fdf5}
recoveryenabled         Yes
osdevice                partition=C:
systemroot              \Windows
resumeobject            {69db61ae-5dc5-11e1-8bc1-bb2a8301fdf5}
nx                      OptOut

Real-mode Boot Sector
identifier              {53d01ece-5e3e-11e1-94cf-9e5144662cd0}
device                  partition=C:
path                    \syslinux.bin
description             ESXi

Real-mode Boot Sector
identifier              {657ad556-5e3e-11e1-94cf-9e5144662cd0}
device                  partition=C:
path                    \linux.bin
description             RedHat

Real-mode Boot Sector
identifier              {c4a9ea4a-6a30-11e1-8e1a-f59982b714d6}
device                  partition=C:
path                    \xen.bin
description             Xen

This seemed to boot Grub just fine, but everything else gave an error about no operating system found. I have not spent more time to troubleshoot it.

End Result
Everything available from Grub.   I know it's cheesy to take a picture of a monitor, but until someone gets me some test boxes with out of band management (hint hint, Cisco and/or Fujitsu), this is how it's going to be.

Credit: Information for this solution was gathered from numerous websites in addition to independent research.  In addition to the websites listed above, some of the others which provided instrumental information are:


  1. If you want to make it work with BCDEdit, do this:

    Install ESXi partition using this option during install time "formatwithmbr"...

    Found this out from

    Didn't work until used that option.

    Followed your directions for that section and once it was formatted that way... system booted into ESXi on the first try.

  2. You should be able to reinstall ESXi over the top of itself and I selected reinstall not upgrade (second line that preserves the VMFS volumes).

    1. how did you install esxi the first time? pls see my question below.

  3. Hi; how did you go about installing each hypervisor? what order did you install them in and what, if any, "tricks" did you employ in the process? thanks

    1. Hi Basat.

      Read my post below for a run through but in short if you install Windows first then install any other OS / Hypervisor you want after you can then use the Windows boot menu by using the EasyBCD tool/program.

      Cheers, Luke

  4. A very interesting read. I have to say though I may have found an easier way to do this. Currently I have only got Windows Server 2012 and ESXi 5.1 dual booting (as that is all I need / want).

    I installed Windows Server 2012 (so I can use Hyper-V) first onto the first disk (HD0); as Chris explains above Windows does not like being placed anywhere but the first HDD.

    I then installed ESXi 5.1 onto the second disk (HD1). For this you need to select the second HDD as part of the ESXi installation.

    Once this was done I booted back into Windows Server 2012 (which is done automatically being as it is on the first disk). Once there i installed and the ran EasyBCD. In “Add New Entry”, I installed the NeoGrub bootloader and then clicked configure and appended the below to the end of the file and saved (dont forget to substitute hd1 with the drive you installed ESXi on if different to the second disk).

    default 0
    timeout 0

    title ESXi 5.1
    map (hd1) (hd0)
    chainloader (hd1)+1
    rootnoverify (hd1)

    Reboot and you will get a Windows boot menu with "Windows Server 2012" and "NeoGrub Bootloader" listed. Selecting "NeoGrub Bootloader" will boot to ESXi. Feel free to change timeouts and the "NeoGrub Bootloader" name back in Windows by running EasyBCD.

    I am sure if you install the other OS' in this blog (RHEL 6 & XenServer 6) onto other hard drives (say HD2 & HD3) then you can just add those entries into the "NeoGrub Bootloader" config file too.

    1. This comment has been removed by the author.

    2. Hello,
      I have tried the above as per your suggestion.
      some how ESXi installed to HDD2, and Ihave modified
      the NeoGrub (hd1) to (hd2), it doesn't work.
      but if I take out HDD0 it will boot to Esxi fine.
      any suggestion?


  5. I like what you have done there. I'd do it myself too soon. But, just to keep things simple, isn't installing Xen, and ESXi on flash drives save all the trouble?

  6. Luke Lloyd, I can confirm that what you suggested works perfectly also with XenServer 6.2. Very easy - if you purchase the easybcd software :). But hey, 30$ is not much and are worth every penny. THX!!

  7. Great blog!!!! Its really helps you to solve your problem go through it and free from your problem
    BOOTMGR Missing in Windows 7
    Aalia lyon

  8. Just wanted to say thanks for this. I learnt and successfully dual booted ESXI 6 and XS 6.5 after finding this article.

  9. Rock on! I do a lot of multi-boot, multi-os, multi-arch installs myself. I can say honestly though I've never tackled Xen, but lately I keep landing on great write-ups including the Xen platform. I'm inspired to explore. Thank you!

  10. Can anyone indicate how to install Ubuntu/ linux and dual boot exsI..

    Which one should i install first ?
    And how do i point the boot loader to the other (depending on which we install first)


  11. Impressive blog with lovely information. really very useful article for us thanks for sharing such a wonderful blog...  Summer Camp for Kids in Chennai | Summer courses in Shozhinganallur | Summer classes in Chennai

  12. Thanks for sharing this valuable information to our vision. Keep your post regularly...Very nice to sharing....
    Excellent Graphics Designing Technical Boot Camp in Chennai | Perfect Vacation Courses in Chennai


  13. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly. 
Summer Courses in Perungudi | Summer Courses in OMR | Summer Courses in Velachery

  14. A pride for me to be able to discuss on a quality website because I just learned to make an article on.... Best Vacation Course in Chennai | Perfect Summer Courses in Porur

  15. Great put Good stuff.All the topics were explained quickly understand for me.I am waiting for your next fantastic blog.Thanks for sharing.
    Summer Camp for Kids in Chennai | Summer courses in Shozhinganallur | Summer classes in Chennai

  16. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
    Summer Courses for Android in Perungudi | Summer Courses for IOS in Velachery | Summer Courses in OMR

  17. Impressive blog with lovely information. really very useful article for us thanks for sharing such a wonderful blog... 
    Summer Courses in Perungudi | Summer Courses in OMR | Summer Courses in Velachery

  18. Thanks for this grateful information. all this information is very important to all the users and can be used good at all this process.
    Selenium Summer Courses in Velachery | Web designing summer Classes in Adyar | Android summer Courses in OMR

  19. This will help you gain an insight on the process of coding, as is done by experienced programmers.

    training institute in chennai for java

  20. I would like to get a purse like that. It seems to me that I have a good time surfing your site.
    Cisco CCNP Certification Exam Center in Chennai | Best CCNP Training in Velachery

  21. Nice and usefull contents. thanks for sharing. expecting much in the future.

    RPA Training in Chennai

  22. This was an nice and amazing and the given contents were very useful and the precision has given here is good.hadoop training in chennai

  23. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    Final Year Project Center for BE in Chennai | Final Year Projects for BE in Velachery

  24. Excellent post!!! The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
    Hardware and Networking Certification Exam Training in Chennai | No.1 Network Training in Alandur

  25. I am really happy with your blog because your article is very unique and powerful for new reader.
    selenium training in chennai
    selenium training in bangalore

  26. Amazing Blog, you have given the correct data that will be useful to us. Keep sharing
    VLSI Project Center in Chennai | VLSI Project in Velachery

  27. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    Real Time Project Center in Chennai | Real Time Project in Kanchipuram

  28. Those rules moreover attempted to wind up plainly a decent approach to perceive that other individuals online have the indistinguishable enthusiasm like mine to get a handle on incredible arrangement more around this condition
    fire and safety course in chennai

  29. This blog is the general information for the future. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.

    Cloud Training
    Software Testing Training
    Oracle DBA Training
    Angular Training in Chennai

  30. Very interesting content which helps me to get the indepth knowledge about the technology. To know more details about the course visit this website.
    Qtp training in Chennai
    Big Data Training in Chennai
    Hadoop Training in Chennai
    JAVA Training in Chennai
    Java classes in chennai

  31. Have you played gambling for a long time? Come to us and win right away. good luck on your side. best slots game online .Good luck does not turn away from you, take risks and win.

  32. rather long internet look up has at the end of the day been compensated with pleasant insight to talk about with my family and friends.
    iosh course in chennai

  33. Amazing article. Your blog helped me to improve myself in many ways thanks for sharing this kind of wonderful informative blogs in live. I have bookmarked more article from this website. Such a nice blog you are providing ! Kindly Visit Us @ Tours and Travels in Madurai | Best Travels in Madurai | Madurai Travels

  34. Разные виды товаров есть у нас, но лучшее это светодиодная лента купить Украина можно это сделать у компании Экодио

  35. Wonderful post. Thank you for updating such an informative content.

    Best Python Training Academy in Kanchipuram

  36. The article is so informative. This is more helpful for our
    software testing training institute in chennai
    selenium training Thanks for sharing

    mobile application development training online
    mobile app development course
    mobile application development training
    mobile app development course online
    mobile application development course
    online mobile application development
    learn mobile application development