Testing nanoBSD image using VMWare

From MyWiki

Jump to: navigation, search

I needed a way to do basic testing of nanoBSD images I build for embedded devices without the need to burn it to flash and have an ALIX board at hand to test it. Basically, a time saving quick testing environment.

Of course the final and more thorough testing is done on the hardware the image is going to run, but for development I need something quick and something I can use "on the go" while I'm away from home Lab.

I'm using VMWare Fusion on my Mac, so the logical first choice was to find a way to convert nanoBSD disk image into a VMWare .vmdk one.

While searching the web fo I came across the article "Converting a Physical Disk to a VMWare Virtual Disk" that pointed me in the right direction. Although, the qemu-img parameters turned out to be incorrect for the version of qemu I'm using in my FreeBSD build environment (qemu-0.11.1_5), nevertheless it was more than enough to get it sorted in 10 minutes after reading man qemu-img.

Here is what I did.

1) Built my nanoBSD image as usual using nanobsd.sh script

2) Checked format of the result file to make sure I'm using the right parameters later:

daemon# qemu-img info _.disk.full 
image: _.disk.full
file format: raw
virtual size: 3.8G (4043289600 bytes)
disk size: 3.8G

3) Convert the nanoBSD image file into VMWare .vmdk one:

daemon# qemu-img convert -f raw -O vmdk _.disk.full my-router.vmdk
daemon# ls -l my-router.vmdk 
-rw-r--r--  1 root  wheel  1131413504 Dec 23 12:05 my-router.vmdk

4) Checked the result image format:

daemon# qemu-img info myt-router.vmdk
image: my-router.vmdk
file format: vmdk
virtual size: 3.8G (4043289600 bytes)
disk size: 1.0G

Done!

Now I'm able to copy the file over to my Mac and create a new VMWare guest using the disk image.

Personal tools