Novell Home

My Favorites

Close

Please to see your favorites.

XEN: Attaching disk images or raw disks with LVM volume groups in Dom0 for disaster recovery

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

Environment


Novell SUSE Linux Enterprise Server 10 Service Pack 1

Situation

A Xen DomU is unable to boot and/or the disk needs to be manipulated by Dom0.

Resolution

The procedure describe in this TID is an advanced rescue method and should only be performed if you are confortable with the procedure described. If you are unsure about your ability, please call Novell Technical Services to assist you in the procedure described here.

WARNING: This document assumes that the LVM volume group inside the DomU does NOT SHARE THE SAME NAME AS A LVM VOLUME GROUP IN DOM0. If you follow the instructions on this TID and there is a name collision you MAY CORRUPT DOM0 as well. If a name-space collision happens, then the Dom0 may become unstable. The most common namespace collision occurs with the "system" volume group, as it is the default name for volume groups at installation time. For this reason, it is suggested to name volume groups within Xen DomU's something other than "system".

This method uses the fact that Dom0 is really a para-virtual instance of SLES running on the Xen hyper-visor. Dom0 is both a privelaged domain and the driver domain, which means that it is tasked with loading the drivers and can manipulate the other DomU's. The same tools that are used to manipulate the DomU's, can therefore, be used to manipulate Dom0. The method described here can be used to attach disks to other other DomU's as well. Any user following this TID would be well advised to look at the man page for "xm".

setup
  1. Make sure that the Xen DomU is shut down
  2. Backup the DomU. This is highly recommended.
    For disk images, make a backup copy
    For raw disks, use "dd" to make a backup, for example
    dd if=/dev/xen_vg/sles10-disk0 of=/root/sles10-disk0.img
  3. Find where the disk is for the DomU. This can be found in the configuration file for the DomU or by using the "xm list -l DOMU_NAME" command.
  4. Attach the disk image or logical volume to Dom0.
    Example for a disk image:
    xm block-attach 0 file:/var/lib/xen/sles10/disk0 xvda w
    Example for a LVM Logical Volume
    xm block-attach 0 phy:/dev/xen-vg/sles10-disk0 xvda w
    Example for an EVMS volume
    xm block-attach 0 phy:/dev/evms/sles10-disk xvda w
  5. Scan for new volume groups
    vgscan
  6. If you do not see the volume group, detach and try again
    xm block-detach 0 xvda
  7. The new volume group now needs to be activated. Replace "sys" with the name of the volume group.
    vgchange -ay sys
  8. Scan for logical volumes. The volume group should now be shown as active.
    lvscan
  9. Mount the logical volume that needs to be mounted. Replace the device with your device and your mount point.
    mount /dev/sys/ROOT /mnt
  10. The data is now accessable for manipulation

clean-up
This is very important. In order to make sure that you do not corrupt data, make sure that you perform these steps. If you do not, you will not be able to start the DomU.
  1. Umount the volume
    umount /mnt
  2. Deactive the volume group. Replace "sys" with the name of your volume group.
    vgchange -an sys
  3. Scan the logical volumes to make sure they are "inactive."
    lvscan
  4. Detach the disk from Dom0
    xm block-detach 0 xvda

Disclaimer

This Support Knowledgebase provides a valuable tool for NetIQ/Novell/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:7000062
  • Creation Date:10-APR-08
  • Modified Date:27-APR-12
    • SUSESUSE Linux Enterprise Server

Did this document solve your problem? Provide Feedback