[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] problem on cloing guest (SOLVED)


  • To: xen-users@xxxxxxxxxxxxxxxxxxx
  • From: Stephen Liu <satimis@xxxxxxxxx>
  • Date: Tue, 16 Sep 2008 14:29:10 +0800 (CST)
  • Delivery-date: Mon, 15 Sep 2008 23:29:52 -0700
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=UuFY0FsFzWTAj0ogwO9dUqSnNFCwGgei7GwdhUvnEvNj5VgqYupA/EIbqQU/qOuXkqh/9ama929NABNugWKBsUr/ZXl/7I4vuiIgO/GS6BIHz7O096nRlqcLfvG05edn1678X+aubzO3Zb8zyBHHFkR26bkudAANOvPX/nohG5I=;
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

H Antoine and folks,


I found the solution which is extremely easy.  To clone image we use dd
command NOT "cp" as mistakenly used by me previously.


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
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
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:
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:
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


My next test will be Virtual USER.  How to use one external IP shared
on >100 mail servers.  All domains are pointing to the same
external/fixed IP.  I think Postfix, transport, will do the job.  But
how?  Pointer would be appreciated.



B.R.
Stephen L



--- Stephen Liu <satimis@xxxxxxxxx> wrote:

> 
> --- Antoine Benkemoun <antoine.benkemoun@xxxxxx> wrote:
> 
> > Hello,
> > 
> > I don't think I was clear in my previous message but that's because
> I
> > was on
> > my PDA.
> > 
> > Basically, xen-tools and, in your case xen-create-image, is used to
> > create
> > images of ready-to-use Linux OS's. In your case, you already have
> > that image
> > since you copied it. If you already have it, you do not need to
> > create it
> > again therefore you do not need to use xen-tools.
> > 
> > You will find a file extremely likely named xen1.satimis.com.cfg in
> > /etc/xen
> > which is the file that Xen uses to start your VM. When xen-tools
> > creates an
> > image, it also creates this file for you :) But since you're not
> > using
> > xen-tools, there is no file for your new VM. So you copy paste
> > xen1.satimis.com.cfg to xen2.satimis.com.cfg in the same directory.
> > Afterwards, you will just need to modify the file according to the
> > location
> > of the images.
> > 
> > Afterwards you should just have to issue a standard xm create
> command
> > to
> > start it.
> > 
> > There you go, don't hesitate if you have more questions. I think
> this
> > was
> > much clearer.
> 
> 
> Hi Antoine,
> 
> 
> I did it before without success.
> 
> 
> Test performed as follows;
> 
> 
> 1)
> On console-1
> 
> # cp -p /etc/xen/xen2.satimis.com.cfg /etc/xen3.satimis.com.cfg
> 
> edit "xen3.satimis.com.cfg"
> changing;
> name    = 'xen2.satimis.com'
> vif  = [ 'ip=192.168.0.112' ]
> 
> as
> name    = 'xen3.satimis.com'
> vif  = [ 'ip=192.168.0.113' ]
> 
> 
> # xm create /etc/xen/xen3.satimis.com.cfg
> Using config file "/etc/xen/xen3.satimis.com.cfg".
> Started domain xen3.satimis.com
> 
> 
> # xm console xen3.satimis.com
> Linux version 2.6.18-xen (shand@endor) (gcc version 3.4.4 20050314
> (prerelease) (Debian 3.4.3-13)) #1 SMP Fri May 18 16:11:33 BST 2007
> BIOS-provided physical RAM map:
>  Xen: 0000000000000000 - 0000000002800000 (usable)
> 0MB HIGHMEM available.
> 40MB LOWMEM available.
> ACPI in unprivileged domain disabled
> Allocating PCI resources starting at 10000000 (gap:
> 02800000:fd800000)
> Detected 2009.313 MHz processor.
> Built 1 zonelists.  Total pages: 10240
> Kernel command line: root=/dev/hda1 ro
> Enabling fast FPU save and restore... done.
> Enabling unmasked SIMD FPU exception support... done.
> Initializing CPU#0
> PID hash table entries: 256 (order: 8, 1024 bytes)
> Xen reported: 2009.258 MHz processor.
> Console: colour dummy device 80x25
> Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
> Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
> Software IO TLB disabled
> vmalloc area: c3000000-fb7fe000, maxmem 33ffe000
> Memory: 28788k/40960k available (2075k kernel code, 3960k reserved,
> 738k data, 192k init, 0k highmem)
> Checking if this processor honours the WP bit even in supervisor
> mode... Ok.
> Calibrating delay using timer specific routine.. 4019.53 BogoMIPS
> (lpj=20097650)Security Framework v1.0.0 initialized
> Capability LSM initialized
> Mount-cache hash table entries: 512
> CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
> CPU: L2 Cache: 512K (64 bytes/line)
> Checking 'hlt' instruction... OK.
> SMP alternatives: switching to UP code
> Freeing SMP alternatives: 12k freed
> Brought up 1 CPUs
> migration_cost=0
> NET: Registered protocol family 16
> Brought up 1 CPUs
> PCI: setting up Xen PCI frontend stub
> ACPI: Interpreter disabled.
> Linux Plug and Play Support v0.97 (c) Adam Belay
> pnp: PnP ACPI: disabled
> xen_mem: Initialising balloon driver.
> PCI: System does not support PCI
> PCI: System does not support PCI
> NET: Registered protocol family 2
> IP route cache hash table entries: 512 (order: -1, 2048 bytes)
> TCP established hash table entries: 2048 (order: 2, 16384 bytes)
> TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
> TCP: Hash tables configured (established 2048 bind 1024)
> TCP reno registered
> IA-32 Microcode Update Driver: v1.14a-xen <tigran@xxxxxxxxxxx>
> audit: initializing netlink socket (disabled)
> audit(1221525846.634:1): initialized
> VFS: Disk quotas dquot_6.5.1
> Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
> Initializing Cryptographic API
> io scheduler noop registered
> io scheduler anticipatory registered
> io scheduler deadline registered
> io scheduler cfq registered (default)
> Floppy drive(s): fd0 is unknown type 15 (usb?), fd1 is unknown type
> 15
> (usb?)
> Failed to obtain physical IRQ 6
> floppy0: no floppy controllers found
> RAMDISK driver initialized: 16 RAM disks of 16384K size 1024
> blocksize
> loop: loaded (max 8 devices)
> Xen virtual console successfully installed as tty1
> Event-channel device installed.
> netfront: Initialising virtual ethernet driver.
> Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
> ide: Assuming 50MHz system bus speed for PIO modes; override with
> idebus=xx
> PNP: No PS/2 controller found. Probing ports directly.
> i8042.c: No controller found.
> mice: PS/2 mouse device common for all mice
> md: md driver 0.90.3 MAX_MD_DEVS=256, MD_SB_DISKS=27
> md: bitmap version 4.39
> NET: Registered protocol family 1
> NET: Registered protocol family 17
> Using IPI No-Shortcut mode
> netfront: device eth0 has copying receive path.
> xen-vbd: registered block device major 3
> blkfront: hda1: barriers enabled
> blkfront: hda2: barriers enabled
> XENBUS: Device with no driver: device/console/0
> md: Autodetecting RAID arrays.
> md: autorun ...
> md: ... autorun DONE.
> EXT2-fs warning (device hda1): ext2_fill_super: mounting ext3
> filesystem as ext2VFS: Mounted root (ext2 filesystem) readonly.
> Freeing unused kernel memory: 192k freed
> serial_core: no version for "struct_module" found: kernel tainted.
> Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing
> disabled
> INIT: version 2.86 booting
> Activating swap...Adding 262136k swap on /dev/hda2.  Priority:-1
> extents:1 across:262136k
> done.
> Checking root file system...fsck 1.40-WIP (14-Nov-2006)
> /dev/hda1: clean, 17398/262144 files, 90856/524288 blocks
> done.
> Setting the system clock..
> Cleaning up ifupdown....
> Loading kernel modules...done.
> Loading device-mapper supportdevice-mapper: ioctl: 4.7.0-ioctl
> (2006-06-24) initialised: dm-devel@xxxxxxxxxx
> .
> Checking file systems...fsck 1.40-WIP (14-Nov-2006)
> done.
> Setting kernel variables...done.
> Mounting local filesystems...done.
> Activating swapfile swap...done.
> Setting up networking....
> Configuring network interfaces...done.
> INIT: Entering runlevel: 2
> Starting system log daemon: syslogd.
> Starting kernel log daemon: klogd.
> * Not starting internet superserver: no services enabled.
> Starting OpenBSD Secure Shell server: sshdNET: Registered protocol
> family 10
> lo: Disabled Privacy Extensions
> IPv6 over IPv4 tunneling driver
> .
> Starting periodic command scheduler: crond.
> 
> Debian GNU/Linux 4.0 xen2.satimis.com tty1
> 
> xen2.satimis.com login: satimis
> Password:
> Last login: Sun Sep 14 11:45:30 2008 on tty1
> Linux xen2.satimis.com 2.6.18-xen #1 SMP Fri May 18 16:11:33 BST 2007
> i686
> 
> The programs included with the Debian GNU/Linux system are free
> software;
> the exact distribution terms for each program are described in the
> individual files in /usr/share/doc/*/copyright.
> 
> Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
> permitted by applicable law.
> satimis@xen2:~$
> 
> 
> On console-2
> 
> # xm list
> Name                                      ID   Mem VCPUs      State  
> Time(s)
> Domain-0                                   0  3417     2     r-----  
>  
> 74.2
> xen3.satimis.com                           2    32     1     -b----  
>  
>  2.4
> 
> 
> # xm create /etc/xen/xen2.satimis.com.cfg
> Using config file "/etc/xen/xen2.satimis.com.cfg".
> Error: Device 769 (vbd) could not be connected.
> File /vserver/domains/xen2.satimis.com/disk.img is loopback-mounted
> through /dev/loop2,
> which is mounted in a guest domain,
> and so cannot be mounted now.
> * end *
> 
> 
> xen2.satimis.com can't be started.  They can't share image.  
> 
> Even if they can there will be problem.  E.G. xen2.satimis.com is an
> existing/running Mail Server.  I change it on xen3.satimis.com as a
> new
> Mail Server with new config.  Then the existing Mail Server will be
> wiped out.
> 
> 
> 
> 2)
> Continue
> 
> 
> On Host
> # mkdir /vserver/domains/xen3.satimis.com/
> 
> # cp -p /vserver/domains/xen1.satimis.com/swap.img
> /vserver/domains/xen3.satimis.com/
> 
> # cp -p /vserver/domains/xen1.satimis.com/disk.img
> /vserver/domains/xen3.satimis.com/
> 
> 
> Re-edit
> xen3.satimis.com.cfg
> 
> adding following change;
> 
> changing;
> disk    = [ 'file:/vserver/domains/xen2.satimis.com/disk.img,hda1,w',
> 'file:/vserver/domains/xen2.satimis.com/swap.img,hda2,w' ]
> 
> as;
> disk    = [ 'file:/vserver/domains/xen3.satimis.com/disk.img,hda1,w',
> 'file:/vserver/domains/xen3.satimis.com/swap.img,hda2,w' ]
> 
> 
> # xm create /etc/xen/xen3.satimis.com.cfg
> Using config file "/etc/xen/xen3.satimis.com.cfg".
> Started domain xen3.satimis.com
> 
> 
> # xm console xen3.satimis.com
> Error: Domain 'xen3.satimis.com' does not exist.
> 
> 
> # xm list
> Name                                      ID   Mem VCPUs      State  
> Time(s)
> Domain-0                                   0  3417     2     r-----  
> 
> 162.4
> 
> 
> xen3.satimis.com is NOT started
> 
> 
> B.R.
> Stephen L
> 
> 
> 
> 
> > 
> > On Mon, Sep 15, 2008 at 2:09 PM, Stephen Liu <satimis@xxxxxxxxx>
> > wrote:
> > 
> > > Hi Antoine,
> > >
> > >
> > > Thanks for your advice
> > >
> > >
> > > antoine.benkemoun@xxxxxx wrote:
> > >
> > > > the error is most likely because you deleted some lines in
> > > > xen-tools.cfg.
> > >
> > >
> > > Here is xen-tools.conf
> > >
> > >
> > > # cat /etc/xen-tools/xen-tools.conf
> > >
> > > size   = 4Gb      # Disk image size.
> > > memory = 128Mb    # Memory size
> > > swap   = 128Mb    # Swap size
> > > # noswap = 1      # Don't use swap at all for the new system.
> > > fs     = ext3     # use the EXT3 filesystem for the disk image.
> > > dist   = sarge    # Default distribution to install.
> > > image  = sparse   # Specify sparse vs. full disk images.
> > >
> > > passwd = 1
> > >
> > > mirror = http://ftp.au.debian.org/debian/
> > > * end *
> > >
> > >
> > > > You don't need to use xen-create-image because you
> > > > already have the image since you copied it from a previous
> guest.
> > > > The solution is to directly create the .cfg file located in
> > /etc/xen
> > > > in order to tell it to use your image :-)
> > >
> > >
> > > # ls /etc/xen/
> > > auto                  xen1.satimis.com.cfg   
> > xend-pci-permissive.sxp
> > > xmexample1
> > > qemu-ifup             xen2.satimis.com.cfg    xend-pci-quirks.sxp
> > > xmexample2
> > > scripts               xend-config.sxp        
> xm-config-xenapi.xml
> > > xmexample.hvm
> > > xen1.example.com.cfg  xend-config-xenapi.sxp  xm-config.xml
> > > xmexample.vti
> > > * end *
> > >
> > >
> > > Whether you meant running;
> > >
> > > # cp -p /etc/xen/xen1.satimis.com.cfg
> /etc/xen/xen3.satimis.com.cfg
> > >
> > > then changing the content on the newly created
> xen3.satimis.com.cfg
> > for
> > > xen3?
> > >
> > >
> > > And then;
> > >
> > > # mkdir /vserver/domains/xen3.satimis.com/
> > >
> > > # cp -p /vserver/domains/xen1.satimis.com/swap.img
> > >
> >
>
/vserver/domains/xen3.satimis.com/<http://xen1.satimis.com/swap.img/vserver/domains/xen3.satimis.com/>
> > > # cp -p /vserver/domains/xen1.satimis.com/disk.img
> > >
> >
>
/vserver/domains/xen3.satimis.com/<http://xen1.satimis.com/disk.img/vserver/domains/xen3.satimis.com/>
> > >
> > >
> > > > You shoild be able to find
> > > > an example file easily.
> > >
> > >
> > > I have been googling around unable to find an example.  All come
> > across
> > > are running lvcreate.   Unfortunately I don't have partition on
> HD
> > nor
> > > running LVM.
> > >
> > >
> > > B.R.
> > > Stephen L
> > >
> > >
> > > > On 9/15/08, Stephen Liu <satimis@xxxxxxxxx> wrote:
> > > > > 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
> > > > > /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
> > > > >
> > > > > 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
> > > > > * end *
> > > > >
> > > > >
> > > > > # tail /var/log/xen-tools/xen3.satimis.com.log
> > > > > 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.
> > > > > * end *
> > > > >
> > > > >
> > > > > What does it mean "Error:  No recognised installation type"?
> > > > >
> > > > >
> > > > > Please advise how to fix the problem.  TIA
> > > > >
> > > > >
> > > > > B.R.
> > > > > Stephen L
> > > > >
> > > > > Send instant messages to your online friends
> > > > http://uk.messenger.yahoo.com
> > > > >
> > > > > _______________________________________________
> > > > > Xen-users mailing list
> > > > > Xen-users@xxxxxxxxxxxxxxxxxxx
> > > > > http://lists.xensource.com/xen-users
> > > > >
> > > >
> > > >
> > > > --
> > > > Antoine Benkemoun
> > > > Tel : 03.51.53.57.00
> > > > Port : 06.32.88.59.35
> > > >
> > >
> > >
> > > Send instant messages to your online friends
> > http://uk.messenger.yahoo.com
> > >
> > 
> > 
> > 
> > -- 
> > Antoine Benkemoun
> > Tel : 03.51.53.57.00
> > Port : 06.32.88.59.35
> > 
> 
> 
> Send instant messages to your online friends
> http://uk.messenger.yahoo.com 
> 
> _______________________________________________
> Xen-users mailing list
> Xen-users@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-users
> 


Send instant messages to your online friends http://uk.messenger.yahoo.com 

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.