There are two ways of using snap-guest: traditional image manipulation and
cloud image based snapping.

Traditional image manipulation

First of all you need to create base image using any method you want (e.g.
virt-manager). It's recommended to use "base" string in the guest name
(e.g. fedora-10-base or rhel4-base) to differentiate those files (snap-guest
lists them using -l option), but it is not mandatory (option -a lists them
all). The template image format can be qcow2 as well as different one (raw on
LVM for example).

Feel free to configure the base image according to your needs. It's recommended
to install a few packages like ntpd or acpid. Make sure network is also on when
switching off NetworkManager. The following blog post contains more information
about configuring base (or "template") guest:

Warning

There is one important thing you need to know. Once you have some guests,
you must not start template (base) image, because that would break the
"child" guests.

You also must not change a template even when the "child" guests are
not running. Again, if anything changes in a template, images based on the
template will be corrupted. Sooner or later.

Trust me, it can seem to work since there is lot of files in a modern
distribution (even a minimal installation). But the probability you corrupt
some important files is very high. The template must not change when there are
"child" guests - never ever.

The only safe way to change something in a template is to destroy all the
"child" guests, change it and then re-provision them again. It's not big deal -
it is fast, you know.

Network

The script modifies network settings in /etc/sysconfig directory (hostname and
MAC address of the eth0). The MAC address is generated based on the hostname -
the same hostname always gives the same address. Example:

This is great for testing - when you provision a box called let's say "test"
and delete it, once it is provisioned again with the same name, DHCP will
assign it the very same IP address. You can keep hostnames and IPs in the
/etc/hosts file and if you won't be shut down your guests for longer periods,
IPs never change.

It is also possible to provision guests with static network settings. It is
currently available for Fedora and Red Hats. Example options:

Additionally, if you use snap-guest on the same host where KVM is running,
there is a flag that adds entries to your /etc/hosts automatically. See help
section for more details.

Recommended disk layout

Since snap-guest does not support LVM, you have to rely on the formatted
partition. It is recommended to use separate dedicated partition for
snap-guest. I am happy with ext4 using the extent option enabled and a
bigger block size. Something like:

So

Snap-guest is a great tool for developing or testing. It's simple and fast.

Credits and license

The script is distributed as public domain.

Original script was written by Red Hat folks (Jason Dobies, Shannon Hughes,
Mike McCune and others), I have slightly modified it, I was using it and after
few improvements I decided to share it with the world.

Special thanks to all who improve this set of scripts. See AUTHORS for full
list.