# Migrating ESXi 6.5 VM to bhyve using vm-bhyve



## al mello (Nov 2, 2018)

Folks,

It seemed to be easy:

- Copied the vmdx to my freebsd box
- Converted to raw with qemu
- Create a new VM with vm-bhyve, using the converted raw disk

Now the fun starts.

I assume, keep me honest here, the vm conf file uses the UUID to boot, i.e.:



> loader="bhyveload"
> cpu=4
> memory=2048M
> network0_type="virtio-net"
> ...



as it boots and can't find the partition to boot from:



> Trying to mount root from ufs:/dev/da0s1a [rw]...
> mountroot: waiting for device /dev/da0s1a...
> Mounting from ufs:/dev/da0s1a failed with error 19.
> 
> ...



Looking at the other server in single mode, glabel status give me:



> Name  Status     Component
> ufsid/5acf74a5c6bfdbaa      N/A    da0s1a



Any ideas how I can make that VM work with vm-bhyve?

Thanks!


----------



## yuripv (Nov 2, 2018)

Just type `?` as it suggests, manually specify ufs:/dev/<the-device-name-you-got-from-?> to mount root, and once it has booted, edit the `mountfrom` loader variable.


----------



## al mello (Nov 2, 2018)

yuripv said:


> Just type `?` as it suggests, manually specify ufs:/dev/<the-device-name-you-got-from-?> to mount root, and once it has booted, edit the `mountfrom` loader variable.



Sorry, I think I didn't get there yet:



> mountroot> ?
> 
> List of GEOM managed disk devices:
> diskid/DISK-BHYVE-F515-E945-EA00 vtbd0
> ...



It the above correct?


----------



## yuripv (Nov 2, 2018)

How about /dev/vtbd0s1a?


----------



## al mello (Nov 2, 2018)

yuripv said:


> How about /dev/vtbd0s1a?



Nope for vtbd0s1a:



> mountroot> vfs.root.mountfrom=ufs:/dev/vtbd0s1a
> Trying to mount root from vfs.root.mountfrom=ufs:/dev/vtbd0s1a []...
> Mounting from vfs.root.mountfrom=ufs:/dev/vtbd0s1a failed with error 2: unknown file system.



Nope for the diskID with and without /dev (with /dev below):



> mountroot> vfs.root.mountfrom=ufs:/dev/DISK-BHYVE-F515-E945-EA00
> Trying to mount root from vfs.root.mountfrom=ufs:/dev/DISK-BHYVE-F515-E945-EA00 []...
> Mounting from vfs.root.mountfrom=ufs:/dev/DISK-BHYVE-F515-E945-EA00 failed with error 2: unknown file system.


----------



## yuripv (Nov 2, 2018)

Oh, sorry I didn't notice it in previous post, you don't need to specify the vfs.root.mountfrom= part, simply provide the ufs:/dev/vtbd0s1a at the prompt.


----------



## al mello (Nov 2, 2018)

yuripv said:


> Oh, sorry I didn't notice it in previous post, you don't need to specify the vfs.root.mountfrom= part, simply provide the ufs:/dev/vtbd0s1a at the prompt.



Don't be sorry, you are just trying to help.

It didn't work. Tried and got error 19:



> mountroot> ufs:/dev/vtbd0
> Trying to mount root from ufs:/dev/vtbd0 []...
> Mounting from ufs:/dev/vtbd0 failed with error 22.
> 
> ...


----------



## yuripv (Nov 2, 2018)

You seem to have a typo in there, it's vtbd, not vtdb.


----------



## al mello (Nov 2, 2018)

yuripv said:


> You seem to have a typo in there, it's vtbd, not vtdb.



Sorry, long day. It seems would have be easier just to recreate from scratch, but like they say: _Never give up! Never surrender!_ (Galaxy Quest)



> List of GEOM managed disk devices:
> diskid/DISK-BHYVE-F515-E945-EA00 vtbd0
> 
> mountroot> ufs:/dev/vtbd0
> ...


----------



## yuripv (Nov 2, 2018)

It's a long day indeed, that should be ufs:/dev/vtbd0s1a, no trailing 1.


----------



## al mello (Nov 2, 2018)

yuripv said:


> It's a long day indeed, that should be ufs:/dev/vtbd0s1a, no trailing 1.



LOL ... 



> mountroot> ufs:/dev/vtbd0s1a
> Trying to mount root from ufs:/dev/vtbd0s1a []...
> mountroot: waiting for device /dev/vtbd0s1a...
> Mounting from ufs:/dev/vtbd0s1a failed with error 19.



Not going (if I typed right this time  )


----------



## yuripv (Nov 3, 2018)

Now that you got it correct, and still getting error 19 (ENODEV), it looks like we are failing in vfs_mountroot_wait_if_neccessary() because the device is simply not there, which I have only one explanation at the moment -- disk image conversion was unsuccessful.


----------



## al mello (Nov 3, 2018)

yuripv said:


> Now that you got it correct, and still getting error 19 (ENODEV), it looks like we are failing in vfs_mountroot_wait_if_neccessary() because the device is simply not there, which I have only one explanation at the moment -- disk image conversion was unsuccessful.



Thanks, yuripv. I'll try another time with added know-how thanks to you. If I pass this phase will post back here.


----------

