Xen - problem on cloing guest

Discussion in 'Server Operation' started by satimis, Sep 15, 2008.

  1. satimis

    satimis Member

    Hi folks,


    Host - Debian Etch


    Encountered problem on cloing guest.

    Remark: No partition on HD nor have LVM


    Steps performed as follows;


    # find / -name *.img
    Code:
    /initrd.img
    /vserver/domains/xen1.satimis.com/swap.img
    /vserver/domains/xen1.satimis.com/disk.img
    /vserver/domains/xen2.satimis.com/swap.img
    /vserver/domains/xen2.satimis.com/disk.img
    

    # mount -o loop /vserver/domains/xen2.satimis.com/disk.img /mnt
    No complaint


    # xen-create-image --copy=/mnt --hostname=xen3.satimis.com --ip=192.168.0.113 --dist=etch
    Code:
    
    General Infomation
    --------------------
    Hostname       :  xen3.satimis.com
    Distribution   :  etch
    Fileystem Type :  ext3
    
    Size Information
    ----------------
    Image size     :  4Gb
    Swap size      :  128Mb
    Image type     :  sparse
    Memory size    :  128Mb
    Kernel path    :  /boot/vmlinuz-2.6.18-xen
    
    Networking Information
    ----------------------
    IP Address 1   : 192.168.0.113
    Netmask        : 255.255.255.0
    Gateway        : 192.168.0.1
    
    Error:  No recognised installation type.
    
    Logfile produced at:
             /var/log/xen-tools/xen3.satimis.com.log
    

    # tail /var/log/xen-tools/xen3.satimis.com.log
    Code:
    Image type     :  sparse
    Memory size    :  128Mb
    Kernel path    :  /boot/vmlinuz-2.6.18-xen
    
    Networking Information
    ----------------------
    IP Address 1   : 192.168.0.113
    Netmask        : 255.255.255.0
    Gateway        : 192.168.0.1
    Error:  No recognised installation type.
    

    What does it mean "Error: No recognised installation type"?


    Please advise how to fix the problem. TIA


    B.R.
    satimis
     
  2. satimis

    satimis Member

    Solved

    Hi folks,


    I found the solution which is extremely easy. To clone image we use dd command NOT "cp".


    The complete steps are as follows;


    On Host

    To duplicate xen2.example.com

    # mkdir /vserver/domain/xen3.example.com

    # dd if=/vserver/domains/xen2.example.com/disk.img of=/vserver/domains/xen3.example.com/disk.img bs=4k
    Code:
    524288+0 records in
    524288+0 records out
    2147483648 bytes (2.1 GB) copied, 70.7044 seconds, 30.4 MB/s
    

    # dd if=/vserver/domains/xen2.example.com/swap.img of=/vserver/domains/xen3.example.com/swap.img bs=4k
    Code:
    65536+0 records in
    65536+0 records out
    268435456 bytes (268 MB) copied, 4.33293 seconds, 62.0 MB/s
    

    # cp -p /etc/xen/xen2.example.com.cfg /etc/xen/xen3.example.com.cfg

    edit the newly created file "xen3.example.com.cfg"

    make following changes;

    old:
    Code:
    disk    = [ 'file:/vserver/domains/xen2.example.com/disk.img,hda1,w', 'file:/vserver/domains/xen2.example.com/swap.img,hda2,w' ]
    
    name    = 'xen2.example.com'
    
    vif  = [ 'ip=192.168.0.112' ]
    
    as
    new:
    Code:
    disk    = [ 'file:/vserver/domains/xen3.example.com/disk.img,hda1,w', 'file:/vserver/domains/xen3.example.com/swap.img,hda2,w' ]
    
    name    = 'xen3.example.com'
    
    vif  = [ 'ip=192.168.0.113' ]
    

    leaving other data intact.


    Start the new Guest VM;

    # xm create /etc/xen/xen3.example.com.cfg

    # xm console xen3.example.com


    Edit following files

    /etc/hosts
    /etc/hostname
    /etc/network/interfaces
    etc.

    making appropriate changes.


    That is ALL. Now it is EASY to clone 100 Guest VMs running 100 servers on the same PC.


    ENJOY


    satimis
     

Share This Page