bhyve Boot a bhyve Windows VM from existing virtual drive.

Hello,
I am trying to create a Windows VM but I need to boot from my own file. Originally I had it in VHDX format, but using qemu-img I now have it in .img and .vhd formats as well.
I managed to create a virtual machine which booted with the help of cbsd and this video FreeBSD: Bhyve with UEFI VNC support but it only boots from an installation ISO.
Is there a way to boot the VM from my virtual drive.
Also I am open to using other tools except cbsd like vm. The reason I use cbsd currently is because I found the video I linked.
Thanks in advance!
Regards,
Georgi.
 
What kind of disk (virtio-blk, ahci, etc.) did you give the Windows VM?
Thank you for your reply!
I created the test VM with mostly stock settings which you can see in the attached images.
Regarding the automatically created disk, created by cbsd it is ahci-hd.
I have also attached a picture of what I see when I try to attach a disk. It seems this menu can only create a new disk, rather than attach my existing one.
 

Attachments

  • storage_config.png
    storage_config.png
    17.1 KB · Views: 14
  • storage_config_add.png
    storage_config_add.png
    16.8 KB · Views: 11
  • storage_config_dsk1.vhd.png
    storage_config_dsk1.vhd.png
    17.7 KB · Views: 10
  • vm_confib_main_1.png
    vm_confib_main_1.png
    102.1 KB · Views: 11
  • vm_config_main.png
    vm_config_main.png
    94.6 KB · Views: 11
Ok, ahci-hd looks good, Windows should have support for that. Does it boot at all? Configuration seems to have been set to UEFI boot, maybe it's not set up for that? Try a CSM (aka BIOS) boot.
 
Ok, ahci-hd looks good, Windows should have support for that. Does it boot at all? Configuration seems to have been set to UEFI boot, maybe it's not set up for that? Try a CSM (aka BIOS) boot.
Yes it boots and works, be it without internet, but this is not the biggest issue currently.
I installed windows 10 on it just as a test and it works great. Next step for me is to attach the virtual disk I have.
As I mentioned I have it in VHDX VHD and IMG formats. Could you help me figure out how I can attach it and boot from it?
 
You can't use any of the VM guest formats like VHD, VDI or VMDK, it has to be a "plain" 1-to-1 image of the drive. Then, instead of the zvol attach the image file to it. Another option is to dd(1) that image file onto the zvol device and use that.
 
Could you please explain with some more detail how do I attach the image file to the VM? I am still new to this software and FreeBSD in general and couldn't find a way to do it.
 
You can't use any of the VM guest formats like VHD, VDI or VMDK, it has to be a "plain" 1-to-1 image of the drive. Then, instead of the zvol attach the image file to it. Another option is to dd(1) that image file onto the zvol device and use that.
This is what I have in my zvol for the vm:
Bash:
root@T460s:/dev/zvol/zroot/jails/windows1 # ls -l
total 0
crw-r-----  1 root operator 0x193 Dec 18 14:32 dsk1.vhd


How do I dd the image into the zvol and why is the disk for the VM in .vhd format bhyve it doesn't support it?

I guess writing the img to the zvol in this way is wrong or please correct me:
dd if=dsk1.img of=/dev/zvol/zroot/jails/windows bs=1M
 
Back
Top