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
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
The command "xm block-attach" is used to hot plug a disk to a DomU.
Command Syntax: xm block-attach [BackDomain]
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.
- Discover the attached disk
fdisk -l /dev/xvda
- Mount the root file system. In this TID, the root file system is on the second partition of /dev/xvda
mount /dev/xvda2 /mnt
- Check to make sure that the file system mount on /mnt is the one that you want
- Mount any other needed file system under mount. Typical examples are /var and /home
mount /dev/xvda3 /mnt/home
- "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
- After you are done, exit the chrooted environment
exit
- Unmount partitions on the disk
- If you are using LVM or EVMS in Dom0 you may have to remove the device mapper mappings
kpartx -d /dev/xvda
- 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
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com