taking snaphost and creating template of Xen domain
By ejannett on juil. 28, 2008
For testing purpose I've used vmware images. One of the advantages was to be able to take snapshots of an image.
And to make these snapshots a template for furture image creation.
When developing on windows platforms all this save you a lot of time.
Now I am using Xen on latest release of Solaris. This great but I was missing snapshots and templates.
Thank to ZFS I am happy again.
The trick is simple : use ZFS volume to create your guests and just use cloning and snapshot feature of ZFS.
In this example I use a file to create the zfs pool, this is not reliable but this is enough as we are testing
1 - Create a file.
#mkfile -n 10g /my-image-file
2 - Create a pool on that file.
#zpool create mypool /my-image-file
#zpool status mypool
scrub: none requested
NAME STATE READ WRITE CKSUM
mypool ONLINE 0 0 0
/my-image-file ONLINE 0 0 0
3 - Create a volume on that new created pool.
#zfs create -V 10g mypool/myhostdisk
4 - Create the guest on this new volume.
virt-install --name=foo --hvm --file-size=10 --ram=1024 --os-type=windows --vnc --cdrom=win.iso --file=/dev/zvol/dsk/mypool/myhostdisk
That's it ! each time you want a snapshot, shutdown the guest and take a snapshot of the volume.
Cloning the snapshot will give templates.