Question

I'm working with Xen 4.0 on a debian Lenny (5.0) . I wanted to clone a VM , but it seems that i didn't do it well . What i did is the following :

  1. Creating the config file of the new VM and setting it up.

    #cd /etc/xen/vms/
    #cp original.foo.com.cfg copy.foo.com.cfg
    
  2. Copying virtual disks

    #cd /dev/mapper/
    #cp -rv vg--xen-original.foo.com--disk vg--xen-copy.foo.com--disk
    #cp -rv vg--xen-original.foo.com--swap vg--xen-copy.foo.com--swap
    
    #chmod g+w vg--xen-copy.foo.com--*
    #chown root:disk vg--xen-copy.foo.com--*
    
  3. Symlinks

    #cd /dev/vg-xen/
    #ln -s ../mapper/vg--xen-copy.foo.com--disk copy.foo.com-disk
    #ln -s ../mapper/vg--xen-copy.foo.com--disk copy.foo.com-disk
    
  4. Everything is set up, let's create the VM

    #xm create /ect/xen/vms/copy.foo.com.cfg
    #Using config file "./copy.foo.com.cfg".
    #Error: Device 51714 (vbd) could not be connected.
    #Device /dev/mapper/vg--copy.foo.com--disk is mounted in a guest domain,
    #and so cannot be mounted now.
    

Could you please help me sort out that issue ?

All i wanted was to duplicate original.foo.com

Thanks

Was it helpful?

Solution

I found the solution.

  #lvcreate -L size -n VM_NAME-disk xen-data
  #lvcreate -L size -n VM_NAME-swap xen-data

Then a byte by byte copy

  #dd if=/dev/mapper/vg-xen-original.foo.com--disk of=/dev/mapper-vg-xen-copy.foo.com--disk
  #dd if=/dev/mapper/vg-xen-original.foo.com--swap of=/dev/mapper-vg-xen-copy.foo.com--swap

Et Voià !!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top