# Chainload FreeBSD 10 within ESX



## smokey7722 (Aug 30, 2014)

Ok so the setup is a little complicated...  I have an ESX server with a raid controller (3ware 9750-4i) being passed into a VM I have created for FreeBSD 10.  However the FreeBSD install is not located on a VMDK, but on a pair of mirrored disks in an array that are hung off the raid controller.  The VM is created merely with the CPU/RAM and other details to define the virtual machine and the raid controller is passed into it (so there is no VMDK for it).  I have done this before with different hardware but for some reason, maybe a compatibility with this motherboard/controller or whatever, its not working here.  I can boot to the FreeBSD 10 Install CD and it picks up the controller + the mirrored pair as da0 and it installs the OS to it with no issues at all.  Though when I attempt to reboot, vmware for some reason won't boot to the passed through controllers array (I assume its not passing the bios of the controller into the vm so it won't boot to it).  So my thought was I would create a small VMDK (1-2MB or whatever I need at absolute minimum) that contains a basic bootloader which will chainload FreeBSD 10 from the array since it seems I can't boot directly to the array.

Right now I have created the freebsd-boot partition and a freebsd-ufs partition on that VMDK and it loads to boot2 and fails.  I have tried all versions of the startup line I can think of to point to the da0 drive and its preexisting kernel but have been unable to do so at this point.  I've then manually loaded "loader" and an lsdev there still does not show the disk from the array to boot to.

So here is my question...  I would like to use a boot loader on a locally created virtual disk in the VM to load an existing FreeBSD 10 install from a physical hard drive that is hung off of the 3ware 9750-4i controller in the VM.  I am hoping I have just missed something but figured this would be the best place to reach out to for assistance.

I hope I explained it without making it sound extremely complicated (moreso than it already is).

Thanks in advance!


----------



## asteriskRoss (Aug 31, 2014)

Allow me to summarise and please correct me if necessary:

 You are using VMware ESX for virtualisation
 FreeBSD 10.0-RELEASE install CD boots and recognises the RAID controller and attached disks passed through to your virtual machine
 You installed FreeBSD to the RAID array
 After installing, FreeBSD doesn't start to boot from the RAID array
 You are able to begin the FreeBSD boot process from a virtual disk, but the RAID controller isn't recognised by /boot/loader.
I see that the RAID controller is supported by the tws(4) driver, which is included in the GENERIC kernel.  I am afraid I have nothing to offer on boot loader support for RAID controllers; perhaps others will.  However, as a work-around, you could host the /boot tree, including the kernel, on your virtual disk.  This is an extension of the approach you have already begun.  By loading your kernel from the virtual disk, the driver for your RAID array will be loaded and then the rest of the system can be started and run from the RAID array.

You don't mention what partitioning scheme(s) (I'll assume GPT) and file systems (I'll assume UFS) you're using; this will affect the details of your configuration.  However, once you have the kernel and associated files on the virtual disk, it is necessary to configure the location of the root file system in /boot/loader.conf with (please adjust for your configuration):

```
vfs.root.mountfrom="ufs:da0p2"
```
You don't absolutely need to mount the /boot file system afterwards, but I would recommend doing so to allow dynamic loading of kernel modules and updates.  When you have /boot on a separate file system, it is not possible to directly mount the /boot directory in the right place.  However, you could configure it (in /etc/fstab) to be mounted at something like /vboot and then create a symbolic link so that everything appears to be in the right place with `ln -s /vboot/boot /boot`.


----------



## smokey7722 (Sep 1, 2014)

Yes, thats about right in regards to the issue.  While FreeBSD supports the raid controller, for some reason ESX is unable to pass the bootable disk correctly into the VM to allow it to boot to it.  I had created the VMDK (even though I wanted to avoid doing so, so I could boot to the physical array) for the bootloader portion as the workaround.  Short of loading the kernel and everything from a VMDK, is there another option that may work, like using an alternative boot loader?  I was just playing with the FreeBSD one in hopes it may had just worked easily.

And yes, GPT and UFS is correct.  If no alternative boot loader or configuration would work, then it seems your version may be the best option.  I'll need to remake the VMDK as its currently only 10MB which would not be large enough to hold the kernel as well.


----------

