NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Boot VM from a zvol using qemu and nvmm?



Jeff Rizzo <riz%tastylime.net@localhost> writes:

> Thanks for the response!
>
> On 9/14/24 11:03 AM, Greg Troxel wrote:
>
>> I have a xen system with images on zfs, and have also been able to boot
>> GENERIC instead of xen, and then run qemu, using the same image zvols.
>>
>> from my qemu script
>>
>> IMG=/dev/zvol/rdsk/tank0/vm/n9-amd64
>>
>> /usr/pkg/bin/qemu-system-x86_64 \
>>      -m 3000 \
>>      -vnc 127.0.0.1:${vnc_port} \
>>      -nographic \
>>      -drive format=raw,file=${IMG},if=none,id=hd0 \
>>      -device virtio-blk-pci,drive=hd0 \
>>      -netdev tap,id=${IFACE},ifname=${IFACE},script=no \
>>      -device virtio-net-pci,netdev=${IFACE},mac=${MAC}
>
> This is pretty close to what I tried (though I just added
> "format=raw") - and I get "Missing OS" on my zvol.  Given that it
> works for you, I suspect it's not set up to boot via QEMU; I need to
> research how this image expects to boot. (I think TrueNAS uses the
> bhyve vmm; I don't actually know anything about it, and I'll have to
> rectify that)  The ones I install myself seem to be OK, so this is
> likely a "boot sector set up wrong" issue.

Indeed, one can boot a PV domU with no boot blocks.   For qemu, you need
to have an MBR boot sector and boot blocks, or maybe EFI.

I was able to run installboot in my domU (when booted in xen) to have
the bootblocks installed, and of course /boot.  You should be able to
fix this pretty readily, but you might have to read boot(8) three times
carefully.


Home | Main Index | Thread Index | Old Index