Our next step in the wonderful HPVM World is… cloning virtual machines.
If you have used VMware Virtual Infrastructure cloning, probably are used to the easy right-click and clone vm procedure. Sadly HPVM cloning has nothing in common with it. In fact the process to clone a virtual machine can be a little creepy.
Of course there is a hpvmclone command and anyone can think, as I did the first time I had to clone an IVM, I only have to provide the source VM, the new VM name and voilà everything will be done:
The new virtual machine can be seen and everything seems to be fine but when you ask for the configuration details of the new IVM a nasty surprise will appear… the storage devices had not been cloned instead it looks that hpvmclone simply mapped the devices of the source IVM to the new IVM:
With this configuration the virtual machines can’t be booted at the same time. So, what is the purpose of hpvmclone if the newly cloned node can’t be used simultaneously with the original? Honestly this makes no sense at least for me.
At that point and since I really wanted to use both machines in a test cluster I decided to do a little research through Google and ITRC.
After reading again the official documentation, a few dozens posts regarding HPVM cloning and HPVM in general and a few very nice posts in Daniel Parkes’ HP-UX Tips & Tricks site I finally came up with three different methods to successfully and physically clone an Integrity Virtual Machine.
METHOD 1: Using dd
Create the LVM structure for the new virtual machine on the host.
Use dd to copy every storage device from the source virtual machine.
Using hpvmclone create the new machine and in the same command add the new storage devices and delete the old ones from its configuration, any resource can also be modified at this point like with hpvmcreate.
Start the new virtual machine and make the necessary changes to the guest OS (network, hostname, etc).
METHOD 2: Clone the virtual storage devices at the same time the IVM is cloned.
Yes, yes and yes it can be done with hpvmclone, you have to use the -b switch and provide the storage resource to use.
I really didn’t test this procedure with other devices apart from the booting disk/disks. In theory the man page of the command and the HPVM documentation states that this option can be used to specify the booting device of the clone but I used to clone a virtual machine with one boot disk and one with two disks and in both cases it worked without problems.
As in METHOD 1 create the necessary LVM infrastructure for the new IVM.
Once the lvols are created clone the virtual machine.
Start the virtual machine.
Now log into the virtual machine to check the start-up process and to make any change needed.
METHOD 3: Dynamic Root Disk.
Since with DRD a clone of vg00 can be produced we can use it too to clone an Integrity Virtual Machine.
First step is to create a new lvol that will contain the clone of vg00, it has to be at least the same size as the original disk.
Install the last DRD version supported on the virtual machin to clone.
Add the new volume to the source virtual machine and from the guest OS re-scan for the new disk.
Now proceed with the DRD clone.
Mount the new image.
On the mounted image edit the netconf file and modify the hostname to “” and remove any network configuration such as IP address, gateway, etc. The image is mounted on /var/opt/drd/mnts/sysimage_001.
Move or delete the DRD XML registry file in /var/opt/drd/mnts/sysimage_001/var/opt/drd/registry in order to avoid any problems during the boot of the clone since the source disk will not be present.
Unmount the image.
Now we are going to create the new virtual machine with hpvmclone. Of course the new IVM can be created through hpvmcreate and add the new disk as its boot disk.
Final step is to boot the newly create machine, from the EFI menu we’re going to create a new boot file.
First select the Boot option maintenance menu:
Now go to Add a Boot Option.
Select the first partition of the disk.
Select the first option.
Enter the HPUX directory.
Select the hpux.efi file.
Enter BOOTDISK as description and None as BootOption Data Type. Save changes.
Go back to the EFI main menu and boot from the new option.
Finally the OS will ask some questions about the network configuration and other parameters, answer what suits better
And we are done.
I have to say that at the beginning the cloning system of HPVM disappointed me; but after a while I got used to it.
In my opinion the best method of the above is the second if you have one boot disk, and I really can’t see a reason to have a vg00 with several PVs on a virtual machine. If you have an IVM as template and need to produce many copies as quickly as possible this method is perfect.
Of course there is a fourth method: Our beloved Ignite-UX. But I will write about it in another post.