Copying VM’s directly between XenClient Systems
NOTE!! Click on Pictures to enlarge them for easier viewing.
If you are working with XenClient GA version 1.0 you have probably run into a situation where you would like to copy your XenClient VM’s to some other computer or storage device. This blog will describe the steps necessary to copy VM’s directly from one XenClient machine to another XenClient machine.
We will assume that we have two XenClient laptops on the same subnet and are both connected to a Gb. switch or are directly cabled together. The XenClient software in use is the GA 1.0 version released on September 29, 2010.
For purposes of this document Laptop #1 has two VM’s already installed on it, a Windows 7 VM and a XP VM. Laptop #1’s ip address is 192.168.1.40.
Laptop #2 has no VM’s installed on it and its ip address is 192.168.1.20.
We will show how to identify and transfer the XP VM from Laptop #1 to Laptop #2.
Open a terminal session on Laptop #1
You will see two files in /storage/disks subdirectory. These correspond to the two VM’s on Laptop #1. The question is which .vhd file is the XP VM?
To determine which .vhd file is the XP VM we need to look inside the .db files that are located in the /config/vms subdirectory.
We will take a look inside the first .db file listed. We could use the vi editor, but in this example we will use the cat command and pipe the output to “more”
After typing the cat command we will scroll through the .db file until we see a statement starting with “path”. Here we can see the .vhd file that is the XP VM. We need to write down this .vhd name as we will need it in future steps. This is the .vhd file that we will transfer to Laptop #2 using the scp command.
From this Point on all work is now performed on Laptop #2
On laptop #2 we need to go through the process of adding a VM. However in the last step of the process we will state that we wish to create the VM, but we will install the OS later. (We will copy the OS from Laptop #1)
Still on Laptop #2 we need to look at the .db file and find out which .vhd file will be associated to it. We need to change directory to the /config/vms subdirectory Then we will use the same “cat” command as we did in step 3.
Make note of the above .vhd file.
Still on Laptop #2 we will change directories to/storage/disks, and then run the scp command to copy the .vhd file from Laptop #1 to a file name of our choosing on laptop #2. After we type in the scp command as shown below, we will be asked for our XenClient password on Laptop #1. Type in the password and continue. You may also be asked a question regarding authenticity. Say yes to this and continue.
It should only take a few minutes to scp the file from Laptop #1 to Laptop #2. This can obviously vary depending upon how large the VM is that we are transferring.
Once scp is finished copying the file you will now have a file named XP-OS.vhd. The final step is to move this file into the .vhd file on Laptop#2 (the .vhd file in step 6).
Now close the terminal window and start the VM.
That’s all there is to it. Hope this helps you.