**Previous:** [[Preparing_the_FreeBSD_system_for_Qemu]]

## Using Qemu from the command line ##

* On FreeBSD, QEMU requires the [AIO(4)](http://www.freebsd.org/cgi/man.cgi?query=aio&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html) kernel module to be loaded. You can load this module with **kldload aio**. If you wish this module to automatically load when you boot FreeBSD, carefully add this line to */boot/loader.conf*:

aio_load="YES"

* Before you can install a guest operating system, you must first create a disk image. The qemu [qcow](http://www.gnome.org/~markmc/qcow-image-format.html) format (*-f*) allows the image to grow (up to the specified maximum size) as data is added. In this example, the name of the disk image is *openbsd.image* (you can give your image any name useful to you). Make sure you have enough disk space to hold the image size you specify.

**qemu-img create -f qcow openbsd.image 10G**

Formatting 'openbsd.image', fmt=qcow size=10737418240 encryption=off

* Create as many disk images as you need (and have disk space for). For example, if you want to install OpenBSD, NetBSD, and DragonFly BSD as guest operating systems, you can create 3 disk images named *openbsd.image*, *netbsd.image*, and *dragonfly.image*.

**qemu-img create -f qcow netbsd.image 10G**

**qemu-img create -f qcow dragonfly.image 10G**

* To install a guest operating system, insert the DVD and specify the name of the image you would like to install into. In this example, 256MB of virtual RAM is allotted to the openbsd.image and qemu is instructed to boot from the cdrom drive:

**qemu  -curses -m 256 -hda openbsd.image -cdrom /dev/acd0 -boot d**

* QEMU supports many options which you can view by typing **qemu**.  You should read through **man qemu** at least once to get a rough idea of how you can customize your disk image and the features available when using your guest operating system under QEMU.

**Next:** [[Using_Aqemu_for_Virtualization]]
