Converting VirtualBox VM to FreeNAS 11 VM

chuckypp

Dabbler
Joined
Jan 29, 2015
Messages
11
Hi all,

I installed FreeNAS 11 and love the VM feature. I've managed to install many fresh Windows installs easily.

I am having an issue however importing in an existing VM. I exported a VirtualBox VM to a raw file and then read somewhere you should just be able to dd it in but that doesn't seem to have worked. Can I check?

My process was:
1. Export VM from VirtualBox - "VBoxManage clonehd "drive.vdi" drive.raw --format RAW
2. Create the zvol as a size slightly bigger than the raw file through the FreeNAS GUI (don't force size, not sparse, block size: 16K default)
3. dd if=drive.raw of=/dev/zvol/volume2/zvol
3. Attach the zvol as a UEFI device to the VM
4. Boot

However it doesn't seem to find the drive at all.

Any ideas what I'm doing wrong or a good faq you could point me to?

Thanks - C
 

chuckypp

Dabbler
Joined
Jan 29, 2015
Messages
11
Just to add, this is what shows up in VNC when it boots.

Capture.PNG


I also tried using the qemu-img approach
$ qemu-img convert -O raw <infile.(vdi|vmdk|$whatever)> /dev/zvol/rpool/data/vm-<id>-disk-1

And it was exactly the same result.
 

usergiven

Dabbler
Joined
Jul 15, 2015
Messages
47
I get that same shell prompt after a cold boot of 16.04 ubuntu desktop (after installing it onto the zvol HD). The VM boots the CD-ROM ISO just fine, but whenever I disconnect the ISO from the VM it tells me "Boot Failed. EFI Hard Drive" and then goes to that prompt
 

chris crude

Patron
Joined
Oct 13, 2016
Messages
210
I get that same shell prompt after a cold boot of 16.04 ubuntu desktop (after installing it onto the zvol HD). The VM boots the CD-ROM ISO just fine, but whenever I disconnect the ISO from the VM it tells me "Boot Failed. EFI Hard Drive" and then goes to that prompt
The Ubuntu issue is well known with VMs, here's a thread about it and how to fix. https://forums.freenas.org/index.ph...tu-desktop-vm-in-uefi-mode.53863/#post-390173
The steps were written for FreeNAS10/corral, but if you go straight to step 2 everything works fine. I used it to setup Ubuntu and added pihole.
Maybe since the original poster has boot issues with a Windows vm, running windows boot repair from its .iso would work too?
 
Last edited:

usergiven

Dabbler
Joined
Jul 15, 2015
Messages
47
Thank you Chris, much appreciated. I was discounting anything from the corral days but it works perfectly now.
 

chris crude

Patron
Joined
Oct 13, 2016
Messages
210
You are welcome. There is another how-to thread on the Linux VM boot issues and fixing it by copying some files from one folder to another. I tried this method i linked because it adds the benefits of updating the original install, which I needed to do to install pihole anyway.
 

chuckypp

Dabbler
Joined
Jan 29, 2015
Messages
11
Hi guys, this didn't help with the issue I am having starting the Windows VM I migrated over.
 

usergiven

Dabbler
Joined
Jul 15, 2015
Messages
47
Sorry for hijacking your thread chuckypp... chris crude above mentioned possibly using the windows ISO file to do a boot repair. I'm not so sure about importing VMs but if you get to that EFI screen, I believe your VM doesn't know where to tell the boot process to start on the drive. Try adding the ISO to your VM, boot it, when you get to the options screen navigate to repair boot problems. I'm not even sure if this would help but try following this and seeing what happens: https://www.groovypost.com/howto/fix-windows-10-wont-boot-startup-repair-bootrec/
 

chuckypp

Dabbler
Joined
Jan 29, 2015
Messages
11
Hi all,

I found a very painful way around it. The short story is while still in VirtualBox upgrade to Window 10 (1703) which has MBR->GPT built in.

Convert it to GPT and do all the Windows bootup repairs to get it booting correctly as UEFI under VirtualBox.

Once complete then follow my process above, in short:
1. Export VM from VirtualBox - "VBoxManage clonehd "drive.vdi" drive.raw --format RAW
2. Create the zvol as a size slightly bigger than the raw file through the FreeNAS GUI (don't force size, not sparse, block size: 16K default)
3. dd if=drive.raw of=/dev/zvol/volume2/zvol
3. Attach the zvol as a UEFI device to the VM
4. Boot

Then it will work.

C
 

chris crude

Patron
Joined
Oct 13, 2016
Messages
210
Hi all,

I found a very painful way around it. The short story is while still in VirtualBox upgrade to Window 10 (1703) which has MBR->GPT built in.

Convert it to GPT and do all the Windows bootup repairs to get it booting correctly as UEFI under VirtualBox.

Once complete then follow my process above, in short:
1. Export VM from VirtualBox - "VBoxManage clonehd "drive.vdi" drive.raw --format RAW
2. Create the zvol as a size slightly bigger than the raw file through the FreeNAS GUI (don't force size, not sparse, block size: 16K default)
3. dd if=drive.raw of=/dev/zvol/volume2/zvol
3. Attach the zvol as a UEFI device to the VM
4. Boot

Then it will work.

C
Glad you sorted it out. I did not need to move any VIrtual Box or VMWare drives to FreeNAS so i was just guessing about fixing the boot somehow. The fix was before you imported, not after.
 

Leprechaun7

Dabbler
Joined
May 31, 2013
Messages
11
Hi all,

I found a very painful way around it. The short story is while still in VirtualBox upgrade to Window 10 (1703) which has MBR->GPT built in.

Convert it to GPT and do all the Windows bootup repairs to get it booting correctly as UEFI under VirtualBox.

Once complete then follow my process above, in short:
1. Export VM from VirtualBox - "VBoxManage clonehd "drive.vdi" drive.raw --format RAW
2. Create the zvol as a size slightly bigger than the raw file through the FreeNAS GUI (don't force size, not sparse, block size: 16K default)
3. dd if=drive.raw of=/dev/zvol/volume2/zvol
3. Attach the zvol as a UEFI device to the VM
4. Boot

Then it will work.

C
Any thoughts on a windows 7 virtualbox guest?
 

tholle

Cadet
Joined
Apr 14, 2019
Messages
5
Hi all,

have the same issue. I've converted a VirtualBox-Guest (Windows 10, GPT-converted) from ova-format into a raw-format with qemu-img as described above.
This raw-file i've copied with dd onto a created zvol, which is designated for the bhyve-VM. When i'm trying to start this VM it ends in the known UEFI-Shell.

Does someone know what i'm doing wrong? Can someone help me out?

Thank you,
tholle
 

Steel-Cat

Explorer
Joined
Jan 24, 2020
Messages
83
and I have the same issue with an old Win XP. Any tipps out there?

I land in the interactive UEFI shell and that it...
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Bhyve does not boot disk images with MBR boot loader. That is a fact. I am facing the same challenge for some legacy VMs but have not found the time to try it, yet. Here's the idea, in case someone wants to take the lead:
  • create a second small disk (2GB or so)
  • make sure that disk comes first in the device order, so it is the boot device
  • put an EFI partition on it with rEFInd installed: https://www.rodsbooks.com/refind/
My hope is that bhyve will boot rEFInd (highly probable) and then rEFInd will be able to pick up the boot loader on the second disk (possible, need to try).

So ... any takers?

HTH,
Patrick
 

Steel-Cat

Explorer
Joined
Jan 24, 2020
Messages
83
sounds interesting...

I want to give it a try

download refind zip and creating new zvol
 

Steel-Cat

Explorer
Joined
Jan 24, 2020
Messages
83
OK, i can boot the refind iso now, how to get in my zvol?

i find no installation
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
You need a running VM, Windows, FreeBSD, ... then attach disk, partition with GPT, format with FAT32, copy rEFInd files ...
 

Steel-Cat

Explorer
Joined
Jan 24, 2020
Messages
83
ah, installing refind external to freenas

hmmm I have a windows 10 and my freenas system

What to do? ... attach disk? ---- you mean the little 2GiB for refind ... ... ist must be a fat32... but how to build this in Freenas in order to attach it?
 
Last edited:

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Add a disk to your virtualbox VM, partition and format it, copy the rEFInd files to the correct location. Create a ZVOL of matching size, convert disk to raw, copy to FreeNAS, use dd to write it to the ZVOL, attach ZVOL to VM ...
 

bignellrp

Dabbler
Joined
Mar 12, 2020
Messages
18
I followed a similar guide to the post above about converting my virtualbox Ubuntu VM into a freenas vm. I'm running a VM in Ubuntu 18.04 on virtualbox 5.2 and want to move it to a VM running in Freenas 11. If i create a VM on ubuntu 18.04 as new it works fine but if i follow the steps to convert to raw, dd into a zvol and attempt to boot i get the same Shell error as above.

Interestingly if i select grub instead of UEFI i get a boot disk cannot be found when the disk is attached.

Any help on this would be appreciated as i tried a data migration from VM to VM but had different issues and burned a whole day attempting it so would rather just keep my working VM and migrate it.
 
Top