日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

KVM配置之(3)- 克隆

發布時間:2025/4/16 编程问答 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 KVM配置之(3)- 克隆 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?1.KVM主機虛擬機直接克隆

virt-clone?-o?module-IT?-n?lb-test2?-f?/data/vm/vmfiles/lb-tes2.img 說明:以modeule-IT做為源,克隆module-IT以及module-IT.img,并創建名稱為lb-test2,鏡像為-f?/data/vm/vmfiles/lb-tes2.img

啟動虛擬機配置主機名,IP地址等

2.通過復制配置文件與磁盤文件的虛擬機克隆(適用于異機的靜態遷移)

(1)確認源虛擬機:

[root@server?~]#?virsh?list?--allId????Name???????????????????????????State ----------------------------------------------------1?????test1??????????????????????????running2?????lu-test1???????????????????????running3?????module-IT-oa-test??????????????running4?????test2-IT???????????????????????running5?????IT-clone-TEST??????????????????running9?????LB_test1???????????????????????running10????lb-test2???????????????????????running-?????clean??????????????????????????shut?off-?????module-IT??????????????????????shut?off-?????Winprinter?????????????????????shut?off [root@server?~]#?virsh?shutdown?LB_test1 Domain?lb-test2?is?being?shutdown

(2).導入KVM虛擬機配置文件

[root@server?~]#?virsh?dumpxml?LB_test1?>/etc/libvirt/qemu/LB_test2.xml

(3).復制KVM虛擬機磁盤文件

[root@server?vmfiles]#?cp?binzai.qcow2?binzai-test2.qcow2

(4).直接編輯配置文件

[root@server?vmfiles]#?vim?/etc/libvirt/qemu/LB_test2.xml? <domain?type='kvm'><name>LB_test1</name>??#由字母和數字組成,不能包含空格<uuid>9ea6f52f-1a18-5a8a-7920-611efa92c8c9</uuid>??#由命令行工具uuidgen生成<memory?unit='KiB'>1048576</memory>???#在不reboot?guest情況下,guset可以使用的最大內存,以KB為單位<currentMemory?unit='KiB'>1048576</currentMemory>??#guest啟動時內存,可以通過virsh?setmem來調整,但是不能大于最大可使用內存<vcpu?placement='static'>1</vcpu>??#分配的虛擬CPU<os><type?arch='x86_64'?machine='rhel6.4.0'>hvm</type>??#架構:64位,machine:宿主機的操作系統<boot?dev='hd'/>??#指定啟動設備,可以重復多行,指定不同的值,作為一個啟動設備列表</os><features>???#處理器特性<acpi/><apic/><pae/></features><clock?offset='utc'/>??#(utc該為localtime)Kvm虛擬機采用utc時間,需要先修改配置文件使用KVM虛擬機的時間與虛擬主機同步。<on_poweroff>destroy</on_poweroff>?#停止虛擬機,相當于關閉電源,Kill?kvm進程也是一樣<on_reboot>restart</on_reboot>??<on_crash>restart</on_crash><devices><emulator>/usr/libexec/qemu-kvm</emulator>??#模擬元素<disk?type='file'?device='disk'><driver?name='qemu'?type='qcow2'?cache='none'/><source?file='/var/lib/libvirt/p_w_picpaths/binzai.qcow2'/>???#使用qumu-img命令創建該文件,kvm?p_w_picpath的默認目錄為:。。。。。<target?dev='vda'?bus='virtio'/><address?type='pci'?domain='0x0000'?bus='0x00'?slot='0x05'?function='0x0'/></disk>???? #采用普通的驅動,即硬盤和網卡都采用默認配置情況下,硬盤為ide模式,采用virtio驅動,硬盤工作在SCSI模式下<controller?type='usb'?index='0'><address?type='pci'?domain='0x0000'?bus='0x00'?slot='0x01'?function='0x2'/></controller><interface?type='bridge'>??#網卡<mac?address='52:54:00:93:45:fe'/><source?bridge='br0'/><model?type='virtio'/><address?type='pci'?domain='0x0000'?bus='0x00'?slot='0x03'?function='0x0'/></interface><serial?type='pty'><target?port='0'/></serial><console?type='pty'><target?type='serial'?port='0'/></console><input?type='tablet'?bus='usb'/><input?type='mouse'?bus='ps2'/><graphics?type='vnc'?port='-1'?autoport='yes'/><sound?model='ich6'><address?type='pci'?domain='0x0000'?bus='0x00'?slot='0x04'?function='0x0'/></sound><video><model?type='cirrus'?vram='9216'?heads='1'/><address?type='pci'?domain='0x0000'?bus='0x00'?slot='0x02'?function='0x0'/></video><memballoon?model='virtio'><address?type='pci'?domain='0x0000'?bus='0x00'?slot='0x06'?function='0x0'/></memballoon></devices> </domain>

(5).定義新虛擬機配置文件

[root@server?vmfiles]#?virsh?define?/etc/libvirt/qemu/LB_test2.xml

(6).啟動虛擬

virsh?start?LB_test2


?

轉載于:https://blog.51cto.com/binbinwudi8688/1353171

總結

以上是生活随笔為你收集整理的KVM配置之(3)- 克隆的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。