Emergency export of a vhd file to virtual-box or the like.
-
Hi Guys,
I'm a bit stuck here. My XCP system has crashed horribly (in another thread) and I really need to get one of the VM's running somewhere reasonably quickly.
As the VM was running on shared storage I have the vhd file on the storage, but the question is, which one of the dozens of vhd files is the one I need.
Is there any way to determine which vhd was attached to which vm without the ability to connect to a running XO or XSconsole?
I'm guessing there probably isn't, but thought it worth the ask.
Peter.
-
@pnunn you can use this command to check for which vdh you need for a specific VM
xe vbd-list vm-uuid=<vm-uuid>
Look in the vdi-uuid, if it is <not in database> that means it is probably a snapshot, ie. not connected.
Use this to check for vm-uuid if you're not sure
xe vm-list
-
I guess @pnunn doesn't have access to
xe
either since the host has crashed.All the information about your VMs and VDIs is written in XAPI's database, an XML file located at
/var/lib/xcp/state.db
.If you can't access the hard drive but have a backup of the metadata (recommended to do regularly for any XCP-ng host. XO can do that), it's the same file contents.
-
By the way, be aware that a single virtual disk is usually represented by several VHD files : base copy, intermediate snaphots... I think you need them all. The database describes all the relationships but it's not that easy to extract the information when it's your first time.
-
Thanks for the input @tony and @stormi. Turns out I've managed to get most of the machines back on the second node after getting some help to force it back to being the master and powering off dead VM's etc. so I think I've avoided having to do this.
It is really useful info however, and I will probably give this a try at some point just so I can if I ever need too.
Thanks again.