[libvirt] libvirtd and LVM snapshots

Daniel P. Berrange berrange at redhat.com
Tue Feb 10 10:05:33 UTC 2009


On Mon, Feb 09, 2009 at 10:03:19PM +0000, Nick Moffitt wrote:
> I'm working on an existing system that creates, manages, and destroys
> Xen guests on a pool of host systems, and I use LVM copy-on-write
> snapshots to keep creation rapid.  
> 
> http://libvirt.org/storage.html describes logical volume pools, for
> which you simply supply the name of a volume group and it allocates
> volumes from that.  By my reading, it appears one can even provide a
> list of block devices and they will be carved into extents and pooled
> into a VG for you.  
> 
> Is there any interface to libvirtd that allows it to create volumes that
> are snapshots of existing volumes?  If not, does anyone have advice for
> doing so manually in a way that plays smoothly with libvirt?

This was recently added in the 0.6.0 release of libvirt. Basically when
creating a storage volume, you just need to pass information about the
backing storage volume. It'll thus create a volume which is a snapshot
of this backing store. 

http://libvirt.org/formatstorage.html#StorageVolBacking

This is currently support for Cow, QCow, QCow2, VMDK and LVM storage
types. Some of these allow for the underling backing store to be 
writable, others require that its readonly.

At time of creation you only need to include the following in the volume
XML

   <backingStore>
          <path>/var/lib/virt/images/master.img</path>
          <format>qcow2</format>
   </backingStore>

Or

   <backingStore>
          <path>/dev/VolGroup00/MasterVol</path>
   </backingStore>


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list