WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] Stable VBD Types

Am Montag, den 20.06.2005, 18:11 +0100 schrieb Alex Adranghi:
[...] 
> Thanks. Although this is relevent to what I'm wanting to do, what I
> meant to say was using lvm snapshots as a way to reduce common files
> from repeating on disk. I quote the LVM-HowTo as it explains it a little
> better.
> 
> "It is also useful for creating volumes for use with Xen. You can create
> a disk image, then snapshot it and modify the snapshot for a particular
> domU instance. You can then create another snapshot of the original
> volume, and modify that one for a different domU instance. Since the
> only storage used by a snapshot is blocks that were changed on the
> origin or the snapshot, the majority of the volume is shared by the
> domU's."
[...]

We use the device-mapper for this. Works for us [tm]:

  dd if=/dev/zero of=/tmp/CoW1 bs=1M count=$CoW_SIZE
  dd if=/dev/zero of=/tmp/CoW2 bs=1M count=$CoW_SIZE

  losetup /dev/loop0 root_fs
  losetup /dev/loop1 /tmp/CoW1
  losetup /dev/loop2 /tmp/CoW2
  
  BLOCKSIZE=`blockdev --getsize /dev/loop0`

  echo "0 $BLOCKSIZE linear                           /dev/loop0   0" \
    | dmsetup create rootfs_base

  echo "0 $BLOCKSIZE snapshot /dev/mapper/rootfs_base /dev/loop1 p 8" \
    | dmsetup create rootfs1

  echo "0 $BLOCKSIZE snapshot /dev/mapper/rootfs_base /dev/loop2 p 8" \
    | dmsetup create rootfs2

You should now be able to use /dev/mapper/rootfs{1|2} read/write. Only
diff blocks to "root_fs" get written to "/tmp/CoW{1|2}". 

This way we boot >20 domUs off one root_fs (after shutdown we delete the
CoW files). I have now clue how to do that with LVM[2].

/nils.  

-- 
there is no sig


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

<Prev in Thread] Current Thread [Next in Thread>