Getting started with Xen virtualization
Debootstrap
Again working as root, mount the formatted partition on the Dom 0 filesystem and cd to the parent directory. The message debootstrap etch mountpoint for Domain U partition ftp://ftp.de.debian.org/debian will now install a complete, basic Debian system from the ftp server. When Debootstrap is done, you should find a complete, basic Etch system in the directory you specified. chroot to this folder; then install the libc6-xen package and disable the libc TLA extensions.
Etch system configuration is slightly more complex than previously, because base-config no longer exists; this handled many tasks automatically in the past. Now, the root user has to install the locales and console-data packages manually and add the following line to the /etc/hosts file:
127.0.0.1 localhost
Next, add the hostname to /etc/hostname, making sure that you use the same name as in your Xen configuration file. You still need to add a matching network card configuration to /etc/network/interfaces for the Dom U.
After linking the correct time zone file to /etc/localtime, it's time to tackle the configuration of the virtual drives in the /etc/fstab file. Listing 2 contains a ready-made fstab that is based on the examples given previously.
Listing 2
Fstab Example for a Debian Dom U
Finally, you will want to set the root password using the passwd command; you might also want to install the OpenSSH server and get out of the chroot jail.
Starting Dom U …
After creating the configuration files for the Dom U and finishing the system setup, you can now start the virtual system. To do so, change directory to /etc/xen and give the following command: xm create -c name of configuration file. The -c parameter redirects the output from the Dom U's virtual screen to the current console. If everything worked out, the login prompt should be displayed after the Linux kernel boot messages. From now on, the init scripts included with the Xen package will automatically launch the new Dom U whenever you boot the system.
… and Stopping It
The xm list command gives an overview of the virtual domains running on your system (Listing 3). In our example, multiple Dom U's are running in the Dom 0, which has 64MB of RAM; one Dom U has 1GB of RAM, and one has 296MB. Entering the xm destroy name of VM command in Dom 0 terminates a virtual machine. The xm top tool displays an updated list of the virtual machines, including their RAM, CPU, and network load, in a similar fashion to the Bash top command (Figure 2).
Listing 3
Listing Virtual Machines
Buy this article as PDF
(incl. VAT)