Using QEMU for Plan 9
The qemu emulator is free open source software that runs on just about everything. We use it extensively ourselves, and recommend it as a solid way of using Plan 9 in combination with any other OS. The combination of a qemu VM as a CPU server and Drawterm to access it is our preferred way of using Plan 9 on machines that aren't running it natively. If you are using linux and have qemu installed from your distro's repository and download the gridtoolsplus.tgz package (gridtools.tgz if you have plan9port and drawterm installed on your own) the gridlord script will handle the tasks of starting a plan9port venti server and extracting the VMs from it and launching them from a simple menu based interface. In windows, the method of using qemu is to extract the VM images and place them in the qemu folder, start cmd.exe and navigate to the qemu folder, and start qemu with a command such as:
qemu -L . -hda ventigridserver.qcow2.img -redir tcp:567::567 -redir tcp:17010::17010
The Windows and linux command line use basically the same commands, with the addition that the windows version adds -L . to tell qemu to load the needed BIOS files from the current directory.
To get the most out of qemu + plan 9, understanding the networking is important. Advanced users may wish to setup a virtual interface for the VM such as tun/tap. We use the simple user-mode networking in qemu, in which qemu acts as a router/dhcp server for the VM, and if you want the VM to provide listening services (such as those required to act as a cpu server or provide web or ftp access) you will need to redirect those ports to the VM. This is the reason for command lines (linux version shown, windows users would have straight-across port redirs and the -L .) such as:
qemu -hda g9.qcow2.img -redir tcp:17010::17010 -redir tcp:2567::567 -redir tcp:2564::564 -redir tcp:22221::21 -redir tcp:22223::23
The specified port redirections all exist to allow the plan 9 service listerns on various ports to respond to incoming calls. The above linux example (which requires the sue of the provided iptablescript for port bouncing) allows the VM to listen on the default cpu, auth, 9fs, ftp, and telnet ports.The linux version of our gridtools provides a set of tiny scripts to launch qemu with port redirection presets in place for various purposes. Windows users can construct their own command lines by knowing what services need what ports to be accessisble. See also the configuration of the plan 9 service listeners in /rc/bin/service or /cfg/$sysname/service.
Linux users please take note of the special issues surround linux port access, redirection, and superuser privileges.
Qemu hard drive images
The 9gridchan images are provided in qemu qcow2 format. This format has a lot of advantages - its fast, and space efficient for initial installation - but a few things to be aware of. Most importantly, they dont get smaller - every write operation is permanently saved, so deleting files inside the VM doesnt reduce the disk usage of the qcow2. However, the combination of Plan 9 and venti means your disks dont need to grow indefinitely - you can always reset them to an initial tiny size by making a new qcow2 image and then using the confighelper system cloner to dupe your system to the new drive. The command to make a new qcow2 is:
qemu-img create -f qcow2 FILENAME SIZE
For instance to make a new .qcow2 with 1 gig of space available:
qemu-img create -f qcow2 myimage.qcow2.img 1G
You can attach multiple virtual hard drives to a qemu image. This is necessary for system duplication and for running the 9gridchan qemu-hosted venti server. Add -hdb imagename to the commandline. For instance, the command for starting the grid venti server with its attached venti data disk in windows is:
qemu -L . -hda ventigridserver.qcow2.img -hdb qventidata.qcow2.img -redir tcp:17034::17034 -m 896
Memory usage
The qemu default is to launch with 128mb. This is adequate for some Plan 9 systems and purposes. The -m flag controls memory size. The default linux launchers give the VMs 256mb each. A Venti server requires more memory. The default configuration of the qemu-hosted 9gridchan venti server has venti cache sizes set quite large and thus requires about 896mb of memory. This can be reduced substantially if desired by chaning the settings in the venti.conf file (/usr/bootes/venti.conf on the ventigridserver.qcow2.img). Another in-machine variable that can be tuned is the size of the fossil disk cache. The confighelper script provides a tool for doing this.