How to boot into rescue mode on a paravirtualized XEN guest
- or - How to access a virtual machines filesystems from Domain-0
Sometimes you have to access the filesystems of a virtual machine without booting the guest. Usualy this is because you are unable
to get Red Hat Linux running completely enough to access files on your system's hard drive (e.g. /boot filesystem is broken or MBR
overwritten).
On a standard (non-virtualized) installation you would boot from CD/DVD and type "linux rescue" at the installation boot prompt.
After you have answered a few simple questions, you will be able to access all filesystems on your harddrives.
Unfortunately this is not possible on a paravirtualized XEN guest! However, there are 2 options to access the filesystems of a
paravirtualized XEN guest from Domain-0:
boot from a (minimal) paralell system This is imho the best solution. You can install a very small Linux in one single file and then add this disk as boot-device to the
configuration file of the virtual machine you want to access.
see here how you can install a paravirtualized XEN guest --> link. Be carefull: You should give the rescue image a different name
for the root volume group (e.g. rescuevg) just to make sure you dont mix up filesystems from the rescue image with the ones from
the broken image.
Lets assume that our minimal image file is "rescue.img". All you have to do now is add this image as primary disk to your DomU configuration.
legacy configuration file in /etc/xen/ before:
(...)disk = [ "tap:aio:/xen/mybrokenimage.img,xvda,w"] (...)
after:
(...)disk = ["tap:aio:/xen/rescue.img,xvda,w", "tap:aio:/xen/mybrokenimage.img,xvdb,w"] (...)
new configuration file (xml)virsh dumpxml DOMAINNAME > guest.xml vi guest.xml
before: (...)<disk type='file' device='disk'> <driver name='file'/> <source file='/xen/mybrokenimage.img'/> <target dev='xvda'/> </disk>
(...)
after: (...)<disk type='file' device='disk'> <driver name='file'/> <source file='/xen/rescue.img'/> <target dev='xvda'/> </disk> <disk type='file' device='disk'> <driver name='file'/> <source file='/xen/mybrokenimage.img'/> <target dev='xvdb/> </disk>
(...)
virsh undefine DOMAINNAME virsh define guest.xml
Now you can start your virtual machine and try to fix your broken image.
Mount guest filesystems from Domain-0
http://fedoraproject.org/wiki/Docs/Fedora8VirtQuickStart#Accessing_data_on_a_guest_disk_image
|