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.
Novell SUSE Linux Enterprise Server 10 Service Pack 1
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".
- Make sure that the Xen DomU is shut down
- Backup the DomU. This is highly recommended. For disk images, make a backup copyFor raw disks, use "dd" to make a backup, for exampledd if=/dev/xen_vg/sles10-disk0 of=/root/sles10-disk0.img
- 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.
- 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 wExample for a LVM Logical Volumexm block-attach 0 phy:/dev/xen-vg/sles10-disk0 xvda wExample for an EVMS volumexm block-attach 0 phy:/dev/evms/sles10-disk xvda w
- Scan for new volume groupsvgscan
- If you do not see the volume group, detach and try againxm block-detach 0 xvda
- The new volume group now needs to be activated. Replace "sys" with the name of the volume group.vgchange -ay sys
- Scan for logical volumes. The volume group should now be shown as active.lvscan
- Mount the logical volume that needs to be mounted. Replace the device with your device and your mount point.mount /dev/sys/ROOT /mnt
- The data is now accessable for manipulation
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.
- Umount the volumeumount /mnt
- Deactive the volume group. Replace "sys" with the name of your volume group.vgchange -an sys
- Scan the logical volumes to make sure they are "inactive."lvscan
- Detach the disk from Dom0xm block-detach 0 xvda
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< Back to Support Search