Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: virt-clone

  1. #1
    Join Date
    Nov 2008
    Beans
    26

    virt-clone

    Hi,

    I am trying to create a clone of a guest machine I managed to created. When I run
    sudo virt-clone -d -o myquest -n guest-01 -f/var/media/myfile.img --connect=qemu:///system

    I get:
    Mon, 16 Feb 2009 12:52:13 DEBUG setup_clone in
    Mon, 16 Feb 2009 12:52:13 DEBUG clone device list: ['/var/media/myfile.img']
    Mon, 16 Feb 2009 12:52:13 DEBUG clone device size: [0]
    Mon, 16 Feb 2009 12:52:13 DEBUG clone device type: [True]
    ERROR: list index out of range

    I have seen a bug report at
    https://bugzilla.redhat.com/show_bug.cgi?id=480253

    but that refers to the Python gui so I don't think it applies in this case.
    Has anyone encountered this problem? Is there some other means that I can take a copy of the guest so I can run it on a different host?

    Thanx,
    Dp.
    Last edited by novice buntu; February 16th, 2009 at 02:19 PM.

  2. #2
    Join Date
    May 2007
    Beans
    251

    Re: virt-clone

    Quote Originally Posted by novice buntu View Post
    Hi,

    I am trying to create a clone of a guest machine I managed to created. When I run
    sudo virt-clone -d -o myquest -n guest-01 -f/var/media/myfile.img --connect=qemu:///system

    I get:
    Mon, 16 Feb 2009 12:52:13 DEBUG setup_clone in
    Mon, 16 Feb 2009 12:52:13 DEBUG clone device list: ['/var/media/myfile.img']
    Mon, 16 Feb 2009 12:52:13 DEBUG clone device size: [0]
    Mon, 16 Feb 2009 12:52:13 DEBUG clone device type: [True]
    ERROR: list index out of range

    I have seen a bug report at
    https://bugzilla.redhat.com/show_bug.cgi?id=480253

    but that refers to the Python gui so I don't think it applies in this case.
    Has anyone encountered this problem? Is there some other means that I can take a copy of the guest so I can run it on a different host?

    Thanx,
    Dp.
    You could just copy the image file to the other host and create a new VM with it. The only thing you'll miss is the XML configuration which specifies settings like network settings (bridge, mac address etc), memory allocated etc.
    If you don't mind re-creating them, you can just copy the image and create a new VM with it. AFAIK, none of these settings are stored in the image file; so, it should be able to pick up the new settings during boot on the other host.

    HTH
    The Unforgiven

  3. #3
    Join Date
    Nov 2008
    Beans
    26

    Re: virt-clone

    Do you mean the image file as specified by the '-f' flag? There is no file created, as a result of the command. I was expecting a image file that I could import with VMWare or similar.

    If you mean take a raw dump of the disk volume the guest resides on, with something like partition manager, I guess that's an option.

    Thanx,
    Dp.

  4. #4
    Join Date
    May 2007
    Beans
    251

    Re: virt-clone

    Quote Originally Posted by novice buntu View Post
    Do you mean the image file as specified by the '-f' flag? There is no file created, as a result of the command. I was expecting a image file that I could import with VMWare or similar.
    No, I meant the original VM image file - the one you're using to boot into the VM already - the one you're trying to clone.

    Are you using a disk partition to boot the VM?
    You can check it up in the XML configuration file of the VM - unfortunately, I've forgotten the path at which you can find this XML

    You can also see the machine details from virt-manager - which is a GUI frontend for libvirt-supported hypervisors.

    Quote Originally Posted by novice buntu View Post
    If you mean take a raw dump of the disk volume the guest resides on, with something like partition manager, I guess that's an option.

    Thanx,
    Dp.
    Taking the dump of the physical volume won't help - you need to get at the VM disk image file - unless you're booting the VM off the physical volume/partition.
    The Unforgiven

  5. #5
    Join Date
    Nov 2008
    Beans
    26

    Re: virt-clone

    Are you using a disk partition to boot the VM?
    Yes it's an LVM Volume?

    I can't seem to mount it on the host machine. The volume is craved up by the guest into 3 partitions. So when I do


    Code:
    mount -t ext3 /dev/mapper/VolOne-myguest /mnt
    I get
    VFS: Can't find ext3 filesystem on dev dm-0.
    So I'm not sure how to proceed. I notice there are some updates for libvirt-bin which I am going to install now. Fingers crossed these will fix the problem with virt-clone.

  6. #6
    Join Date
    Nov 2008
    Beans
    26

    Re: virt-clone

    Unfortunately not
    Tue, 17 Feb 2009 10:11:36 DEBUG clone device size: [0, 0]
    Tue, 17 Feb 2009 10:11:36 DEBUG clone device type: [True, True]
    ERROR: list index out of range

  7. #7
    Join Date
    May 2007
    Beans
    251

    Re: virt-clone

    Quote Originally Posted by novice buntu View Post
    Yes it's an LVM Volume?

    I can't seem to mount it on the host machine. The volume is craved up by the guest into 3 partitions. So when I do


    Code:
    mount -t ext3 /dev/mapper/VolOne-myguest /mnt
    I get


    So I'm not sure how to proceed. I notice there are some updates for libvirt-bin which I am going to install now. Fingers crossed these will fix the problem with virt-clone.
    Well, in this case, I don't think virt-clone can help.
    And since the LVM volume has already been clobbered by the VM by creating partitions *inside* it, you cannot hope to mount it on the host either.

    However, you can dump the partition into a file which can then serve as the disk image for your VM.

    You can use dd to dump the volume into a file:
    Code:
    dd if=/dev/mapper/VolOne-myguest of=/path/to/image/file
    For more details on how to use dd, check its manpage.

    Once this image file is created, you can even loop-mount it onto host.
    The Unforgiven

  8. #8
    Join Date
    Nov 2008
    Beans
    26

    Re: virt-clone

    Is using LVM not a goos idea then you want to create VM guests? Should I just crave up the drive(s) in the extended volume as I need the (boot, swap, root) for each guest.

  9. #9
    Join Date
    May 2007
    Beans
    251

    Re: virt-clone

    Quote Originally Posted by novice buntu View Post
    Is using LVM not a goos idea then you want to create VM guests? Should I just crave up the drive(s) in the extended volume as I need the (boot, swap, root) for each guest.
    Not really..
    Essentially, as long as you keep the meaning of the storage same between guest and host (if it's LVM volume, let it be an LVM volume in the guest as well), there shouldn't be problems.

    What has happened in your case is that host thinks that it's an LVM volume and expects to find the filesystem in it when you try to mount it. But, since you've created partitions *inside* the LV from within the guest, the FS layout and the structures are *one level below*.

    The easiest setup for a VM is just to create a file in the host filesystem that is used as an emulated disk for the VM. This creates least amount of hassles and even if something goes wrong with this file (say, partition table getting corrupted), you can just delete the file and create a new one. The host doesn't get affected. Inside the guest, it's treated as though it's a plain blank HDD and you can create whatever layout you want inside it - LVM, normal DOS partitions, whatever.

    When you share physical disk storage (say, LV or a partition), if the guest happens to mess it up, chances are that your host OS will also be affected because of the clobbered partition table.

    HTH
    The Unforgiven

  10. #10
    Join Date
    Nov 2008
    Beans
    26

    Re: virt-clone

    That has helped. Thanx.

    I wonder if, by creating my VM to use a partition and not a disk file, it has lead to these errors from virt-clone.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •