XEN: Directly attaching Xen DomU disk images to Dom0 for system rescue

This document (3312774) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 10 Service Pack 1

Situation

  • Disk image backed DomU will not boot
  • Access to files inside of a DomU disk image is needed
  • Access via chroot inside of a DomU disk image is needed
 

Resolution

There are several documented ways to rescue a Xen DomU system, some include using lomount or booting the DomU into the rescue system. However, the easiest method of rescuing a DomU is to directly attach the disk image to Dom0.
 
explanation: dom0 is para-virtualized
 
One of the fundamental facts about Xen virtualization is that the hyper-visor, or Xen itself is loaded BEFORE SLES; SLES is loaded by Xen as a privileged domain. SLES 10 then acts as the "driver domain" and fills a couple other roles. Once SLES is loaded, the interaction with the hyper-visor is managed through the "xend" daemon. Since Dom0 is para-virtualized, you can "attach" a Dom0 disk image to Dom0. This method is preferred.
 
 
attach the disk to Dom0

The command "xm block-attach" is used to hot plug a disk to a DomU.

Command Syntax: xm block-attach [BackDomain]
 
Example command:
xm block-attach 0 tap:aio:/var/lib/xen/images/SLES10/disk0 xvda w

The backdev is the device/file that will be attached to the domain. You can use "file:""tap:aio","phy:" and others that Xen supports. It would be recommended to use the backend device specified in the configuration for the Xen DomU.

The frontdev device is where what the device will be presented to the domain as. In our example, we used "xvda", which is the first device. When attaching, you can see what devices are attached. This can be done using the "xm block-list 0" command.

mount and chroot


Once the disk has been attached, you may mount disk and follow normal rescue procedures.
  1. Discover the attached disk
    fdisk -l /dev/xvda
  2. Mount the root file system. In this TID, the root file system is on the second partition of /dev/xvda
    mount /dev/xvda2 /mnt
  3. Check to make sure that the file system mount on /mnt is the one that you want
  4. Mount any other needed file system under mount. Typical examples are /var and /home
    mount /dev/xvda3 /mnt/home
  5. "chroot" is a command that changes the root for the current shell to the specific directory. This is useful because all commands run under a chrooted environment see the chrooted directory as root.
    chroot /mnt
  6. After you are done, exit the chrooted environment
    exit
cleanup
  1. Unmount partitions on the disk
  2. If you are using LVM or EVMS in Dom0 you may have to remove the device mapper mappings
    kpartx -d /dev/xvda
  3. Detach the disk from Dom0
    xm block-detach 0 xvda

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:3312774
  • Creation Date: 14-Feb-2008
  • Modified Date:05-Mar-2021
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center