[xen-tools-discuss] Question about cloning a VM using the --tar and --copy options

Yuvraj Agarwal yuvraj at cs.ucsd.edu
Thu Jun 28 03:32:56 CEST 2012


Hi All,

I am new to this list, so please let me know if there is a better place to
post this question. I have been using xen-tools often and have just updated
our Xen installation to Xen 4.1.2 and the xen-tools that comes with the
Ubuntu 12.04 (64bit) distro - which i think are v 4.2.1.

I was trying to find out examples of cloning an existing VM to create a new
VM, but was unable to find it.

For example, I have a VM image created (testvm2) that has a disk image
(file backed: disk.img) and a swap file (file backed: swap.img) using
xen-create-image. This image uses pygrub and also runs Ubuntu 12.04 (32
bit) in the domU. I have customized it in various ways and next I want to
create a clone of this VM image quickly, lets say "testvm3" and make
whatever changes I need to it so that the two images are distinct and can
both run *simultaneously*. It seems like I should be able to do the
following:

1. I tarred up the disk.img file and named it:
/home/xen/testvm2-disk.img.tar

2. xen-create-image --hostname=testvm3 --size=2G --swap=128M
--ip=10.16.17.67 --netmask=255.255.255.0
--gateway=10.16.17.1 --force --bridge=eth0-br --dir=/home/xen --memory=64M
--install-method=tar --install-source=/home/xen/testvm2-disk.img.tar

That does not seem to work and fails with the following error. Any thoughts
on how to fix this will be appreciated.

thanks!
Yuvraj

.
.
General Information
--------------------
Hostname       :  testvm3.ucsd.edu
Distribution   :  precise
Mirror         :  http://us.archive.ubuntu.com/ubuntu/
Partitions     :  swap            128M  (swap)
                  /               2G    (ext3)
Image type     :  sparse
Memory size    :  64M

Networking Information
----------------------
IP Address 1   : 172.16.17.67 [MAC: 00:16:3E:9F:F0:FD]
Netmask        : 255.255.255.0
Gateway        : 172.16.17.1

Creating partition image: /home/xen/domains/testvm3.ucsd.edu/swap.img
Done

Creating swap on /home/xen/domains/testvm3.ucsd.edu/swap.img
Done

Creating partition image: /home/xen/domains/testvm3.ucsd.edu/disk.img
Done

Creating ext3 filesystem on /home/xen/domains/testvm3.ucsd.edu/disk.img
Done
Installation method: tar
(Source: /home/xen/testvm2-disk.img.tar)
Done
System installation failed.  Aborting
/tmp/jHpF2ish6f/etc/ssh/ssh_host_rsa_key.pub: No such file or directory
Running command 'umount /tmp/jHpF2ish6f/proc 2>&1' failed with exit code
256.
Aborting
See /var/log/xen-tools/testvm3.ucsd.edu.log for details
cannot remove directory for /tmp/jHpF2ish6f: Device or resource busy at
/usr/share/perl/5.14/File/Temp.pm line 902


Also, If I look at the /var/log/xen-tools/testvm3.ucsd.edu.log the last
messages printed are:
.
.
.
(Source: /home/xen/testvm2-disk.img.tar)
Falling back to default tar command
domains/testvm2.ucsd.edu/disk.img
/bin/tar: domains/testvm2.ucsd.edu/disk.img: Wrote only 2560 of 10240 bytes
/bin/tar: Exiting with failure status due to previous errors
WARNING (/usr/bin/xt-install-image): The installed system at
/tmp/jHpF2ish6f doesn't seem to be a full system.
WARNING (/usr/bin/xt-install-image): The installed system is missing the
common file: /bin/ls.
WARNING (/usr/bin/xt-install-image): The installed system at
/tmp/jHpF2ish6f doesn't seem to be a full system.
WARNING (/usr/bin/xt-install-image): The installed system is missing the
common file: /bin/cp.
Done
System installation failed.  Aborting
umount: /tmp/jHpF2ish6f/proc: not found
Running command 'umount /tmp/jHpF2ish6f/proc 2>&1' failed with exit code
256.
Aborting
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://xen-tools.org/pipermail/xen-tools-discuss/attachments/20120627/f7f982d7/attachment.html>


More information about the xen-tools-discuss mailing list