Global Navigation

Xen-Tools.org

Top Navigation

Left Navigation

Content

 
Example Usage

There are several different ways that the xen-tools scripts can be used, so it is difficult to examine all possible usage scenarios. Here will will concentrate upon the installation of Debian Sarge.

The basic default method of installing new Debian GNU/Linux instances is via the debootsrap package, included as part of Debian.

 
Loopback Images

Using loopback images is very straightfoward, all you need to do to prepare is have a directory within which your new Xen guests will be located. This directory should be specified upon the commandline when invoking xen-create-image.

Specifying the directory upon the command line would look like this:

xen-create-image --hostname=test.my.flat \
  --ip=192.168.1.1 \
  --dir=/home/xen \
  --dist=sarge \

(Note: we didn't specify the installation method, or the Debian mirror to use here - we assume those are specified in the configuration file of /etc/xen-tools/xen-tools.conf.)

Once this command has finished you'll be left with the following layout:

/home/xen/
`-- domains
    `-- test.my.flat
	|-- disk.img
	`-- swap.img

2 directories, 2 files

Here you can see that there is a new sub-directory created called test.my.flat, which was the hostname of the new instance we created, and inside that we have two loopback images.

If you're creating several loopback domains you will soon exhaust the default number of loopback devices. Increase the number of loop devices for Xen.

 
LVM Examples

Using LVM logical volumes is a much more efficient process than using the loopback files, however it does require that your host system has LVM setup.

To use the LVM option you specify --lvm=volume-group upon the command line. This option conflicts with the --dir option described above.

A sample command would look like this:

xen-create-image --hostname=test.my.flat \
  --ip=192.168.1.1 \
  --lvm=vol1 \
  --dist=sarge

(Note: Again we didn't specify all the options, assuming that they were defined in the configuration file. As they are by default.)

Once this command has finished you will be able to see your new logical volumes included in the output of lvdisplay:

# lvdisplay -C
  LV		    VG   Attr   LSize  Origin Snap%  Move Log Copy%
  test.my.flat-disk  mine -wi-ao  4.00G
  test.my.flat-swap  mine -wi-ao 20.00M

Here you see the two volumes, one used for the root disk, and one used for swap.

Sidebar

Footer