How To: Import VHD into XenServer
Posted on December 29th, 2009 by admin | No Comments » |
This post comes to us from two of our own experts, Rich Brumpton (of The Generation V) and Duane Bradley (of MSTerminalServices.org) – both MTM Technologies employees. In order to directly import VHDs into a XenServer store, you need to import it into an NFS or EXT3 volume.
Rich Brumpton gives us those easy steps here:
1. Copy VHD to NFS or EXT3 storage
2. Rename to UUID.vhd (pick a unique UUID, I usually just index up by 1 off of an existing one)
3. Run xe sr-scan uuid=sr-uuid (you can use xe sr-list name-label=sr-name
4. Set a Name Label using xe vdi-param-set uuid=disk-uuid name-label=disk-name
5. Attach the imported disk to a VM
Easy enough. But what if you don’t have an NFS share or extra local disk handy to firnat as EXT3? That’s where Duane Bradley comes to the rescue:
1. We need to remove the LVM storage repository first. (Note:If you have VMs on your existing local LVM backed SR make sure you backup or export them and then delete them from the SR before continuing.) To do this, log into the XenCenter command line console and follow these steps:
-
At the console, type cat /etc/xensource-inventory to display the basic server inventory information. Find the DEFAULT_SR_PHYSDEVS= line in the displayed file and make a note of its current setting. In a single disk system this should be something like /dev/sda3.
-
First, we need to determine the UUID for your default SR by issuing the xe sr-list command to display information about it. Make a note of the default UUID.
-
Next, we’ll determine the UUIDof your default SRs PBD by issuing the xe pbd-list sr-uuid=<your SR UUID> command to display the PBD information of your default SR. Make a note of the PBD UUID.
-
Now we’ll disconnect the default SR by issuing the xe pbd-unplug uuid=<your PBD UUID> command to disconnect your default SR.
-
Finally, we need to remove the default SR by issuing the xe sr-destroy uuid=<your SR UUID> to delete the default SR.
2. Now we can create and configure a new default VHD backed Storage Repository using EXT3. Still at tge console, follow these steps:
- At the console, type xe sr-create content-type=”Local SR” host-uuid=(hit tab since you have a single host) device-config-device=<YOUR DEVICE> shared=false name-label=”Local EXT-3 SR” (Note: This command may take a few minutes to complete and will return a UUID for your newly created SR once it is finished.)
- For example: # xe sr-create content-type=”local SR” host-uuid=5d189b7a-cd5e-4029-9940-d4daaa34633d device-config-device=/dev/sda3 shared=false name-label=”Local EXT-3 SR”)
- Make a note of the UUID returned after executing the sr-create command, then set your new SR to be the default SR and default suspend SR by typing the following commands.
- To set your SR as the default SR on the system type the command xe pool-param-set default-SR=<YOUR NEW SR UUID> uuid=(hit tab since you have a single pool) - For Example: # xe pool-param-set default-SR=a803b8d2-1252-14a2-cbc9-c530c7b398c4 uuid=2e95c9dd-14f7-52bd-89f91ab9217cbdc
- To set the default suspend SR, issue the following command: xe pool-param-set suspend-image-SR=<YOUR NEW SR UUID> uuid=(Hit tab since you have a single pool) - For Example:# xe pool-param-set uuid=2e95c9dd-14f7-52bd-89f9-91ab9217cbdc suspend-image-SR=a803b8d2-1252-14a2-cbc9-c530c7b398c4
Now you’re ready to go. Happy Virtualizing!
Posted in Virtualization |
Tags: Tags: How To, XenServer

