bhyve Bhyve how to create a raw image from an existing VM

I am using (vm -- utility to manage bhyve virtual machines) to create VMs on ZFS, here is the output of vm info containing the virtual-disk info:

virtual-disk
number: 0
device-type: sparse-zvol
emulation: virtio-blk
options: -
system-path: /dev/zvol/tank/vms/test/disk0
bytes-size: 42949672960 (40.000G)
bytes-used: 4901912576 (4.565G)

But how could I make a raw image?

I am currently installing ubuntu 22.04 and would like to create a custom image from the VM to be used in Alibaba cloud (supported formats are raw, vhd, qcow2)

Any ideas?
 
That disk0 is a zvol, which is just a raw disk for the VM. You could snapshot and clone that.

Having said that, look at the vm image commands. That allows you to create images from existing VMs. You can use those as templates for new VMs.
 
You're using a zvol, which works very much like a device for a physical harddisk. So, just dump its contents to a file, e.g. with dd(1).
 
Back
Top