Cloning the vm:
First clone the VM using virt-manager UI. (launch # sudo virt-manager, the click on the VM to clone, and right click and select clone).
Assign a new name while cloning.
Ensure the new VM is shutdown and then run virt-sysprep as follows
Then, use virt-sysprep as follows:
virt-sysprep -d <new name of clone> --hostname <new hostname> --root-password password:<new root password>
Here,
-d => decontextualize
Look at man virt-sysprep for more options available.
-------------------
How do you get new name of the clone?
It is the name field available in the xml file.
-------------------
Example:
# virt-sysprep -d node2 --hostname node2 --root-password password:testpassword
[ 0.0] Examining the guest ...
[ 2.8] Performing "abrt-data" ...
[ 2.8] Performing "bash-history" ...
[ 2.8] Performing "blkid-tab" ...
[ 2.8] Performing "crash-data" ...
[ 2.8] Performing "cron-spool" ...
[ 2.8] Performing "dhcp-client-state" ...
[ 2.8] Performing "dhcp-server-state" ...
[ 2.8] Performing "dovecot-data" ...
[ 2.8] Performing "logfiles" ...
[ 2.9] Performing "machine-id" ...
[ 2.9] Performing "mail-spool" ...
[ 2.9] Performing "net-hostname" ...
[ 2.9] Performing "net-hwaddr" ...
[ 2.9] Performing "pacct-log" ...
[ 2.9] Performing "package-manager-cache" ...
[ 2.9] Performing "pam-data" ...
[ 2.9] Performing "puppet-data-log" ...
[ 2.9] Performing "rh-subscription-manager" ...
[ 2.9] Performing "rhn-systemid" ...
[ 2.9] Performing "rpm-db" ...
[ 2.9] Performing "samba-db-log" ...
[ 2.9] Performing "script" ...
[ 2.9] Performing "smolt-uuid" ...
[ 2.9] Performing "ssh-hostkeys" ...
[ 2.9] Performing "ssh-userdir" ...
[ 2.9] Performing "sssd-db-log" ...
[ 2.9] Performing "tmp-files" ...
[ 2.9] Performing "udev-persistent-net" ...
[ 2.9] Performing "utmp" ...
[ 2.9] Performing "yum-uuid" ...
[ 2.9] Performing "customize" ...
[ 2.9] Setting a random seed
[ 2.9] Setting the hostname: node2
[ 2.9] Setting passwords
[ 4.9] Performing "lvm-uuids" ...
=======================================
No comments:
Post a Comment