How To Clone VM with Libguestfs?


Hi today we will look disk image tools/library which is very power full. We will look for now just the tools not the library but in the future we can investigate the library in c or python too. With the era of cloud computing things to be done very fast, practical and precise way.

In the past system administrators was connecting systems one by one and complete operations. But now in the new era system admins do not have much time to do all things so new emerging technologies/tools/… are coming. One of them is libguestfs tools which makes manipulating and operating virtual machine disk images very easy. A typical scenario is that a system administrator creates new vm and install some applications on it and we change root pass and then clone a git repository into the system without touching systems console or terminal. Sounds good 🙂  This is very angary for administrator. This tool makes it very easy we will make this operations with this tool to day.

  • Here is a simple script which I use daily. I create source and dest paths that provides disk images. And then use virt-clone tool to clone existing vm with new disk path and name –auto-clone option makes is very easy. –connect option sets the hypervisor –original sets source vm domain name. –name option is used new vms name. and –file option for new vm disk file path.

  • Now we have a new vm but we have to do a lot of work to complete operation. But with this tool it is easy. Here we use virt-customize command with -d option which means the name of vm nad –install option which specifies the package names that will be installed.
LEARN MORE  Qemu Tutorial

  • Here we change root password and then run scripts to clone testing repository for git. Now we can give the system to the developers. As you can see it is very easy we write just there line of script and do a lot of thing for little tiny time.

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)