Using xen-tools to Delete DomU Virtual Machines in Xen Project Hypervisor

The following is a guide for deleting DomU virtual machines in Xen Project Hypervisor using xen-tools. Although xen-tools supports loopback, EVMS, and LVM partition types, this guide focuses on LVM-based DomU only. That being said, the information provided below may be easily adapted for use with loopback and EVMS-based DomU.

If you’re looking for a tutorial on creating DomU virtual machines using xen-tools, please refer to Using xen-tools to Create DomU Virtual Machines in Xen Project Hypervisor. For an in-depth Xen Projoect Hypervisor tutorial, see Installing Xen Project Hypervisor on Debian 9: An in-depth beginner’s guide.

Software Versions

The software versions used in this guide include xen-tools version 4.7-1 and Xen Project Hypervisor version 4.8 as included in the current stable release of Debian 9 (Stretch).

If xen-tools is not yet installed on your Dom0 host, you may do so by running the following apt-get command as root:

# apt-get install xen-tools

The xen-delete-image Command

Under xen-tools, the xen-delete-image command is used to delete both DomU configuration files and their corresponding partitions. For further reference, the command’s manual page is included with the xen-tools package.

$ man xen-delete-image

As described in the manual page, the xen-delete-image command uses two options (–lvm and –hostname) to take care of its two main tasks.

The first option, –lvm, specifies the LVM volume containing the DomU partition(s) to be deleted. The second option, –hostname, specifies the hostname of the DomU configuration file to be deleted. Note that the “–hostname” option key may be left out, as shown in the example below, so long as a hostname value is included.[1]

It is important to point out that the xen-delete-image command will only delete the “.cfg” configuration file if it is located in the default “/etc/xen” directory. If your specified DomU file is not located in the /etc/xen directory, the file may need to be manually deleted.


In this example a DomU with the hostname “httpserver” is permanently deleted from the system.

If you would like to follow along with the steps below, the tutorial Using xen-tools to Create DomU Virtual Machines in Xen Project Hypervisor provides instructions on creating the example httpserver DomU – that you can then delete!

Before you get started, first verify that the DomU configuration file is located in the standard directory /etc/xen. Second, make note of the LVM volume group that the DomU root and swap partitions are located in. If you’re not sure how to do this, check out the “Other Tips” section below.

For our example, the DomU configuration file is located in the /etc/xen directory and its associated LVM volume group is named “vg0”.

CAUTION!: Running the following command as root will permanently delete the DomU /etc/xen/httpserver.cfg configuration file, and all associated LVM volumes located in vg0 (e.g., httpserver-disk and httpserver-swap).

# xen-delete-image --lvm=vg0 httpserver

After running the above command, the following information is output to terminal:

Deleting: /etc/xen/httpserver.cfg
Removing swap volume
Removing LVM disk volume

This confirms that the httpserver DomU has been successfully deleted from the system.

Other Tips

Before the xen-delete-image command is executed, confirm that the specified DomU configuration file is located in the /etc/xen directory. Using the “ls” command to list and view the directory’s contents is sufficient for this task.

$ ls /etc/xen

Similarly, the associated DomU LVM volume group name should be verified by running the “lvs” command as root. In the resulting output, locate the DomU logical volume(s), “LV”, and the associated volume group name, “VG”.

# lvs

Note that checking the contents of the /etc/xen directory and the output of lvs can also verify that the specified DomU was successfully deleted.


1. For example, the commands “xen-delete-image –lvm=vg0 –hostname=httpserver” and “xen-delete-image –lvm=vg0 httpserver” are identical in function.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s