This is a layout I've starting using on my VMs. I use this scheme to waste as little space on the host as possible and to allow me easy “rollback” to a clean system.
The process I follow is:
Writes should be kept at a minimum before compressing so that no ghost data needs to be recompressed.
I install, exit the VM, snapshot, re-create the clean installation, compressed (compression requires re-creation/copy); create a linked image to be used instead of the clean image (this linked image will store the changes to the base image) and then start using the VM.
This allows me to use the same base image for different set-ups since changes will be written to a separate image (maybe could run even simultaneously although I'm not sure about the performance penalty).
Additionally I use a separate image for swap so that swapped data doesn't get written to the other images (hindering compression).
Finally I use a third image for /home
so that I can rollback the OS without affection homes. I set it up as an LVM volume to allow future expansion with even more images
$ qemu-img create -f qcow2 os.base.qcow2 10G $ qemu-img snapshot -c empty os.base.qcow2 $ ln -s os.base.qcow2 os.qcow2
$ qemu-img create -f qcow2 swap.qcow2 2G $ qemu-img snapshot -c empty swap.qcow2
Optionally move to /dev/shm
for faster guest swap.
$ qemu-img create -f qcow2 home.qcow2 8G $ qemu-img snapshot -c empty home.qcow2
$ qemu-img snapshot -c clean-install swap.qcow2 $ qemu-img snapshot -c clean-install home.qcow2
$ qemu-img convert -c -O qcow2 os.base.qcow2 os.base.compressed.qcow2 $ mv os.base.compressed.qcow2 os.base.qcow2 $ qemu-img snapshot -c clean-install os.base.qcow2 # Optional $ qemu-img create -b os.base.qcow2 -f qcow2 os.delta.qcow2 $ rm os.qcow2 $ ln -s os.delta.qcow2 os.qcow2