XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Emergency export of a vhd file to virtual-box or the like.

    Scheduled Pinned Locked Moved Compute
    5 Posts 3 Posters 1.2k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      pnunn
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • T Offline
        tony
        last edited by

        @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
        
        1 Reply Last reply Reply Quote 0
        • stormiS Offline
          stormi Vates 🪐 XCP-ng Team
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • stormiS Offline
            stormi Vates 🪐 XCP-ng Team
            last edited by

            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.

            1 Reply Last reply Reply Quote 1
            • P Offline
              pnunn
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post