In my opinion, template is the most useful feature in virtualization technology. After creating one fully installed VM, you can create several temporary VMs from the original without spend lots of hours or lots of disk space. In LVM environment, you can use ‘snapshot’ feature of lvcreate command. But, LVM volume is not easy to move between systems especially when you want to upgrade to the latest distribution just like Fedora.
If we can create new VMs from the file-based image, it could be very convenient to migrate between systems and easy to back up. With qemu-img utility you can do the same thing as LVM do.
Following are the steps I did to create new VM from the old one which is file-based.
$ qemu-img convert rhel4u5.img -O qcow2 rhel4u5.qcow2 $ qemu-img create -b rhel4u5.qcow2 -f qcow2 rhel4u5-test1.qcow2 $ virt-install -nrhel4u5-test1 -r512 -v --os-type=linux --os-variant=rhel4 --import --disk path=rhel4u5-test1.qcow2
Easy, isn’t it?
The first step is only necessary when your original VM was created with raw format.
Leave a Reply