FedoraForum.org - Fedora Support Forums and Community
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2010
    Posts
    1,058
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    cloning a VM or using qcow2 snapshot

    I'm using virsh on F19 to manage a VM. I'd like to make a 2nd VM based on it. Should I do this with virsh vol-clone command, or qemu-img snapshot?

    I think I want to create two external snapshots of the current qcow2.img. The original file is used as a read-only backing file for both VMs, with one snapshot as the delta file for VM1, and the other snapshot as the delta file for VM2. Is that correct?

  2. #2
    Join Date
    May 2010
    Posts
    1,058
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: cloning a VM or using qcow2 snapshot

    So I ended up not using virt-clone because everything I read indicates it makes a copy of the qcow2 file and edits some things inside of it to make a clone, only changing the things that need to be unique (like hostname and maybe some other things).

    I renamed the qcow2 file to: F19-base.qcow2 and then issued two commands:
    Code:
    qemu-img create -b F19-base.qcow2 -f qcow2 F19-VM1.qcow2
    qemu-img create -b F19-base.qcow2 -f qcow2 F19-VM2.qcow2
    That creates two external snapshots of F19-base, that are really tiny, 193K each. Peaking inside, they both reference the F19-base.qcow2 file, and I can vouch if you rename the backing qcow2, the external snapshots no longer work. So name the base qcow2 file before you get started.

    Next I updated VM1 to use F19-VM1.qcow2 using virsh edit, and editing the XML configuration file. And I also exported that XML, edited its virtual disk to use F19-VM2.qcow2, it's ethernet interface to a new MAC, and gave it a new UUID, and machine name, and then imported that to create a new virtual machine, VM2.

    So VM1 points to F19-VM1.qcow2, and VM2 points to F19-VM2.qcow2, and each of those point to F19-base.qcow2 as the read only backing file. Upon boot of each VM, their snapshot files grow from 193K to about 12MB, and shortly thereafter about 24MB before stabilizing. Of course with VM2 I had to manually change the hostname using hostnamectl so I could ssh into it using the avahi hostname. But otherwise that's it and both appear to be working.

Similar Threads

  1. Suddenly qcow2 images KVM stopped working
    By mustang7071 in forum Using Fedora
    Replies: 0
    Last Post: 31st July 2010, 05:53 AM
  2. Cloning for a newbi
    By TheFox in forum Using Fedora
    Replies: 3
    Last Post: 31st May 2010, 12:02 PM
  3. Converting Windows XP vmdk to qcow2
    By srbdivb in forum Using Fedora
    Replies: 1
    Last Post: 12th February 2010, 04:30 PM
  4. dd and drive cloning
    By rando1000 in forum Using Fedora
    Replies: 11
    Last Post: 2nd February 2008, 09:49 PM
  5. Replies: 0
    Last Post: 24th September 2006, 07:05 PM

Tags for this Thread

Posting Permissions

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