virt-clone命令可以复制一个已经存在的虚拟机,这个命令只能在vm停机状态使用,它将克隆已存在VM的所有信息,包括UUID和MAC地址。
可以使用virt-sysprep工具来配置新克隆的VM。virt-sysperp初始化虚拟机实例。virt-sysperp会将虚假机初始化到系统刚安装的状态,它会删除掉虚拟机中的ssh key文件、重置网络MAC地址、主机名以及系统用户。
install
yum whatprovides */virt-sysprep
yum install libguestfs-tools -y
run
#初始化[root@kvm-node1 images]# virt-sysprep -d kvm-clone1[ 0.0] Examining the guest ...[ 44.9] Performing "abrt-data" ...[ 44.9] Performing "bash-history" ...[ 44.9] Performing "blkid-tab" ...[ 44.9] Performing "crash-data" ...[ 44.9] Performing "cron-spool" ...[ 44.9] Performing "dhcp-client-state" ...[ 44.9] Performing "dhcp-server-state" ...[ 44.9] Performing "dovecot-data" ...[ 44.9] Performing "logfiles" ...[ 44.9] Performing "machine-id" ...[ 44.9] Performing "mail-spool" ...[ 44.9] Performing "net-hostname" ...[ 44.9] Performing "net-hwaddr" ...[ 44.9] Performing "pacct-log" ...[ 44.9] Performing "package-manager-cache" ...[ 44.9] Performing "pam-data" ...[ 44.9] Performing "puppet-data-log" ...[ 44.9] Performing "rh-subscription-manager" ...[ 44.9] Performing "rhn-systemid" ...[ 44.9] Performing "rpm-db" ...[ 44.9] Performing "samba-db-log" ...[ 44.9] Performing "script" ...[ 44.9] Performing "smolt-uuid" ...[ 44.9] Performing "ssh-hostkeys" ...[ 44.9] Performing "ssh-userdir" ...[ 44.9] Performing "sssd-db-log" ...[ 44.9] Performing "tmp-files" ...[ 45.0] Performing "udev-persistent-net" ...[ 45.0] Performing "utmp" ...[ 45.0] Performing "yum-uuid" ...[ 45.0] Performing "customize" ...[ 45.0] Setting a random seed[ 45.0] Performing "lvm-uuids" ...
# virt-sysprep参数很多,能配置的地方也很多,举个常用的配置hostname和root密码的例子:重置虚拟机主机名和root用户账号(这
标签:基本,...,45.0,virt,Performing,sysprep,44.9
From: https://www.cnblogs.com/cheyunhua/p/17513197.html