天天看點

利用libvirt管理KVM虛拟機

利用libvirt管理KVM虛拟機

本文的原始連結:http://blog.chinaunix.net/uid-1838361-id-257238.html

說明:這篇筆記為更好的管理虛拟化服務,如果僅僅是測試虛拟化,檢視另一篇筆記: http://blog.chinaunix.net/space.php?uid=1838361&do=blog&id=234090

web方式管理虛拟機,檢視: http://blog.chinaunix.net/uid-1838361-id-3060330.html

補充:這篇筆記使用的libvirt版本為0.6.3,kernel為2.6.18-194.26.1.el5 遇到了幾個bug,建議首先更新kernel,然後更新libvirt,kvm。 源: http://centos.ustc.edu.cn/centos/ yum clean all yum makecache  yum list kernel 20110428:kernel 2.6.18-238.9.1.el5

yum update kernel kernel-devel.x86_64 kernel-headers.x86_64

一、安裝虛拟化管理工具 1、yum install virt-manager libvirt libvirt-python python-virtinst

  1. 1、kmod-kvm : kvm kernel module(s)
  2. 2、kvm : Kernel-based Virtual Machine
  3. 3、kvm-qemu-img : Qemu disk image utility
  4. 4、kvm-tools : KVM debugging and diagnostics tools
  5. 5、python-virtinst : Python modules and utilities for installing virtual machines
  6. 6、virt-manager : Virtual Machine Manager (GUI app, to install and configure VMs)
  7. 7、virt-viewer: Virtual Machine Viewer (another lightweight app to view VM console and/or install VMs)
  8. 9、bridge-utils : Utilities for configuring the Linux Ethernet bridge (this is recommended for KVM networking)

KVM Package Group RHEL comes with KVM software group which includes full virtualization support with KVM. You can list all packages in the group as follows:

# yum groupinfo KVM

2、Start the libvirtd daemon service service libvirtd start

關于錯誤: 注:該錯誤出現在centos5.4,libvirtd 0.6.3 重新開機libvirtd後,啟動guest時會出現下面的問題。 Apr 22 09:16:20 srv4 kernel: libvirtd[27156]: segfault at 00000000444e3000 rip 0000003e5501e161 rsp 00000000444dfcd0 error 4 Apr 22 09:16:20 srv4 libvirtd: 09:16:20.739: error : internal error Unable to daemonize QEMU process  重新開機了host,問題解決 原因:https://bugzilla.redhat.com/show_bug.cgi?id=505625 Everytime the virGetCapabilities() method is run, it destroys the existingvirCapsPtr object and creates it again....without any of the selinux info.virt-manager runs this method. so once virt-manager has run, subsequent callsto get the security info will give the crash you see.

二、有關網絡 http://wiki.libvirt.org/page/Networking 1、一般網絡(又名NAT):guest可以通路外網,外網不能通路guest。 安裝了libvirt後,一個NAT網絡即可用。host被設定為192.168.122.1(virbr0),所有的guest将被配置設定為192.168.122.x 如果看不到virbr0 或者在 virsh start <Name of KVM>時出現下面的錯誤: Apr 22 08:50:37 srv4 libvirtd: 08:50:37.839: error : internal error Failed to add tap interface 'vnet%d' to bridge 'virbr0' : No such device 

檢視/var/log/message.log Apr 22 08:57:10 srv4 dnsmasq[26000]: failed to open pidfile /var/run/libvirt/network/default.pid: Permission denied Apr 22 08:57:10 srv4 dnsmasq[26000]: FAILED to start up

手動啟動default network virsh net-start default error: Failed to start network default error: internal error '/usr/sbin/dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/libvirt/network/default.pid --conf-file=  --listen-address 192.168.122.1 --except-interface lo --dhcp-range 192.168.122.2,192.168.122.254 --dhcp-lease-max=253' exited with non-zero status 3 and signal 0:  dnsmasq: failed to open pidfile /var/run/libvirt/network/default.pid: Permission denied 解決辦法: 我的目前系統:selinux-policy.noarch                                               2.4.6-203.el5   yum updata selinux-policy.noarch selinux-policy.noarch                                               2.4.6-279.el5_5.2  service libvirtd restart 注:需要重新開機host,上面寫了原因

  1. # ifconfig virbr0
  2. virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
  3. inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
  4. inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
  5. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  6. RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  7. TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
  8. collisions:0 txqueuelen:0
  9. RX bytes:0 (0.0 b) TX bytes:10962 (10.7 KiB)

一個故障: 不論是NAT,還是Bridge模式,guest都無法與其他伺服器通信,而且NAT模式時無法通過dhcp擷取IP。沒有查到錯誤原因。 不使用virsh來啟動,按照 http://blog.chinaunix.net/space.php?uid=1838361&do=blog&id=234090文章介紹的方法來啟動時,NAT及bridge模式都可以正常通路其他伺服器。是以按照該文章的方法,在guest的xml檔案中定義interface的部分,指定虛拟網卡為tap0,網絡正常了,将指定的網卡名去掉,由virsh自動配置設定為vnet0,網絡也是正常的,也可以通過dhcp擷取IP了。原因未知。 另:virsh啟動的log檔案位于:/var/log/libvirt/qemu/

20110711: nat方式無法擷取IP,service libvirtd restart 重新開機服務,恢複。

關于NAT方式,guest可以擷取ip,但無法與通路公網: 有多個網卡?你的實體機由哪個網卡通路公網?例如,我的實體機由br0通路公網,則,修改default.xml檔案,添加forward的dev參數。

  1. virsh # net-dumpxml default
  2. <network>
  3.   <name>default</name>
  4.   <uuid>8d004490-ee73-4e36-b9ef-821d7e73f9f6</uuid>
  5.   <forward dev='br0' mode='nat'/>
  6.   <bridge name='virbr0' stp='on' forwardDelay='0' />
  7.   <ip address='192.168.122.1' netmask='255.255.255.0'>
  8.     <dhcp>
  9.       <range start='192.168.122.2' end='192.168.122.254' />
  10.     </dhcp>
  11.   </ip>
  12. </network>
  1. virsh # net-define /etc/libvirt/qemu/network/default.xml
  2. virsh # net-destroy default
  3. virsh # net-start  default

2、Bridge網絡(又名:共享實體網卡):guest可以通路外網,外網也可以通路guest # cd /etc/sysconfig/network-scripts/ # cp ifcfg-eth0 ifcfg-br0  兩個配置檔案内容分别為: /etc/sysconfig/network-scripts/ifcfg-eth0

  1. DEVICE=eth0
  2. TYPE=Ethernet
  3. ONBOOT=yes
  4. NM_CONTROLLED=no
  5. BRIDGE=br0

/etc/sysconfig/network-scripts/ifcfg-br0

  1. DEVICE=br0
  2. TYPE=Bridge
  3. NM_CONTROLLED=no
  4. BOOTPROTO=static
  5. IPADDR=221.193.136.121
  6. NETMASK=255.255.255.0
  7. ONBOOT=yes

The NM_CONTROLLED=no option was added because both device should not be controlled by the Network Manager for bridge to work.  重新開機network( 目前連接配接會丢失,確定你總是可以通路host,否則要格外小心) service network restart

關于錯誤:Bringing up interface eth0:  tg3 device eth0 does not seem to be present, delaying initialization. 原因:br0裡沒有加配置 TYPE=Bridge

對于rhel6和centos6,需要關閉NetworkManager  service NetworkManager stop chkconfig --level 35 NetworkManager off Disable Netfilter processing in the bridged traffic. 在 /etc/sysctl.conf檔案中添加:

  1. net.bridge.bridge-nf-call-ip6tables = 0
  2. net.bridge.bridge-nf-call-iptables = 0
  3. net.bridge.bridge-nf-call-arptables = 0
  4. net.bridge.bridge-nf-filter-vlan-tagged = 0

        驗證是否生效 ifconfig br0現在扮演eth0的角色。 br0       Link encap:Ethernet  HWaddr 00:14:5E:C2:1E:40             inet addr:221.193.136.121   Bcast:221.193.136.255  Mask:255.255.255.0            inet6 addr: fe80::214:5eff:fec2:1e40/64 Scope:Link            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1            RX packets:125 errors:0 dropped:0 overruns:0 frame:0            TX packets:81 errors:0 dropped:0 overruns:0 carrier:0            collisions:0 txqueuelen:0            RX bytes:16078 (15.7 KiB)  TX bytes:18542 (18.1 KiB)  eth0      Link encap:Ethernet  HWaddr 00:14:5E:C2:1E:40             inet6 addr: fe80::214:5eff:fec2:1e40/64 Scope:Link            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1            RX packets:206 errors:0 dropped:0 overruns:0 frame:0            TX packets:58 errors:0 dropped:0 overruns:0 carrier:0            collisions:0 txqueuelen:1000            RX bytes:27308 (26.6 KiB)  TX bytes:13881 (13.5 KiB)            Interrupt:74 Memory:da000000-da012800

也可以通過下面的指令檢視橋接網絡,可以看到eth0加到了橋接裝置br0中: # brctl show bridge name     bridge id               STP enabled     interfaces virbr0          8000.000000000000       yes br0             8000.000e0cb30550       no              eth0

三、建立KVM虛拟機的XML定義檔案 關于KVM XML format  http://libvirt.org/formatdomain.html  1.1 用于從磁盤啟動的XML檔案 1、kvm guest 定義開始

  1. <domain type='kvm'>

2、guest的short name。由字母和數字組成,不能包含空格

  1. <name>centosvm1</name>

3、uuid,由指令行工具 uuidgen生成。

  1. <uuid>bdbb89fb-57d1-4d01-b3b7-ff33a9346ae6</uuid>

4、在不reboot guest的情況下,guset可以使用的最大記憶體,以KB為機關

  1. <memory>2048000</memory>

5、guest啟動時記憶體,可以通過virsh setmem來調整記憶體,但不能大于最大可使用記憶體。

  1. <currentMemory>1024000</currentMemory>

6、配置設定的虛拟cpu

  1. <vcpu>2</vcpu>

7、有關OS x86架構:i686   hvm:全虛拟化 kernel:指定guest使用的核心,如果使用ISO(安裝時)或guset系統中(系統已經安裝完成)的核心,不需要指定該項 initrd:指定guest使用的ram disk,如果使用ISO(安裝時)或guest系統中(系統已經安裝完成)的ram disk,不需要指定該項 注:kernel 和initrd檔案位于RHEL系統CD光牒的images/pxeboot目錄,拷貝這兩個檔案到本地磁盤,并指定路徑。 注:這兩個元素,如果是為了安裝guset而指定,在安裝完成以後即可以删除。 如果host開啟了SELINUX,you also need to change the type of security context for the files to virt_image_t to allow libvirtd to access them for booting: 

  1. # chcon -t virt_image_t /tmp/vmlinuz-rhel54
  2. # chcon -t virt_image_t /tmp/initrd-rhel54.img

After you change the security context, verify that the correct security context is assigned to them as shown in the following example: 

  1. # ls -Z /tmp|grep virt
  2. -r--r--r-- root root root:object_r:virt_image_t initrd-rhel54.img
  3. -r--r--r-- root root root:object_r:virt_image_t vmlinuz -rhel54

boot:指定啟動裝置,可以重複多行,指定不同的值,作為一個啟動裝置清單。 可以在cmdline元素中添加啟動參數,例如,使用kickstart檔案: <cmdline>method=http://10.1.1.212/install/rhel5.4/x86_64  ks=http://10.1.1.212/install/autoinst/c20m2n05v3</cmdline>

  1. <os>
  2.       <type arch='x86_64' machine='pc'>hvm</type>
  3.       <kernel>/tmp/vmlinuz-rhel54</kernel>
  4.       <initrd>/tmp/initrd-rhel54.img</initrd>
  5.       <boot dev='hd'/>
  6.     </os>

8、處理器特性

  1. <features>
  2.       <acpi/>
  3.       <apic/>
  4.       <pae/>
  5.     </features>

關于處理器特性,檢視: http://blog.chinaunix.net/space.php?uid=1838361&do=blog&id=1753201

9、時鐘。使用本地時間:localtime     <clock offset='utc'/>

仍然需要再計劃任務中添加時間同步: */15 * * * * (/usr/sbin/ntpdate 210.72.145.44 > /dev/null 2>&1;/sbin/hwclock -w) 10、定義了在kvm環境中power off,reboot,或crash時的預設的動作為destroy。其他允許的動作包括:restart,preserve,rename-restart. 在這個例子中,destory之是以也用在了on_reboot元素中,是因為一旦安裝完成,期望的guest動作是stop,以便從the installed guest operating system而不是從the installation kernel or ISO編輯guest的定義。 destroy:停止該虛拟機。相當于關閉電源

  1.     <on_poweroff>destroy</on_poweroff>
  2.     <on_reboot>destroy</on_reboot>
  3.     <on_crash>destroy</on_crash>

11、裝置定義開始

  1. <devices>

12、模拟元素,此處寫法用于kvm的guest(xen怎麼寫?)

  1. <emulator>/usr/libexec/qemu-kvm</emulator>  

13、用于kvm存儲的檔案。在這個例子中,在guest中顯示為IDE裝置。 使用qemu-img指令建立該檔案,kvm image的預設目錄為:/var/lib/libvirt/images/

  1. <disk type='file' device='disk'>
  2. <driver name='qemu' type='raw' cache='none'/>
  3.         <source file='/var/lib/libvirt/images/kvm3.img'/>
  4.         <target dev='hda' bus='ide'/>
  5.       </disk>

這裡需要注意:使用libvirt 0.6.3寫的xml,沒有 <driver name='qemu' type='qcow2'/>參數,當将該xml放到libvirt 0.8版本時,該參數會預設為raw,是以會造成在0.6中可以啟動的guest無法啟動,更改參數即可 使用virtio: 采用普通的驅動,即硬碟和網卡都采用預設配置情況下,硬碟是 ide 模式,而網卡工作在 模拟的rtl 8139 網卡下,速度為100M 全雙工。采用 virtio 驅動後,網卡工作在 1000M 的模式下,硬碟工作是SCSI模式下。

  1. <disk type='file' device='disk'>
  2.    <driver name='qemu' type='raw' cache='none'/>
  3.    <source file='/usr/local/kvm/vmsample/disk.os'/>
  4.    <target dev='vda' bus='virtio'/>
  5. </disk>

硬碟采用 virtio 後,安裝windows 系統,将不能正常的識别硬碟,解決的方法是:

從kvm 的官網下載下傳virtio的驅動iso。 1. 先采用ide模式安裝系統。 2. 安裝完成後,添加一個virtio模式的硬碟。

3. 啟動vm後,系統會自動搜尋 SCSI的驅動,找到下載下傳的virtio 驅動後,安裝即可。

4. 修改vm 配置檔案,删除掉添加的 vitro 硬碟後,修改ide硬碟為 virtio模式即可。

A Note About Virtio Drivers

Virtio is paravirtualized drivers for kvm/Linux. With this you can can run multiple virtual machines running unmodified Linux or Windows VMs. Each virtual machine has private virtualized hardware a network card, disk, graphics adapter, etc. According to Redhat:

Para-virtualized drivers enhance the performance of fully virtualized guests. With the para-virtualized drivers guest I/O latency decreases and throughput increases to near bare-metal levels. It is recommended to use the para-virtualized drivers for fully virtualized guests running I/O heavy tasks and applications. 

關于cache=none 如果不加該參數,預設cache policy為write through。 kvm官方及IBM都推薦使用raw,設定cache為none,以 關閉kvm磁盤的cache政策,讓資料可以直接落在實體硬碟上(實體機上其實也有磁盤cache的,并不需要kvm為cache操心) For the best storage performance on guest operating systems that use raw disk volumes or partitions,completely avoid the page cache on the host. 下面的文章中有一段關于cache的内容: http://www.linuxeden.com/forum/viewthread.php?tid=205581&extra=&page=3

   補充:可以定義多個磁盤,其他可行的磁盤定義: Logical volume device:

  1. <disk type='block' device='disk'>
  2.             <source 'dev=/dev/mapper/VolGroup01-LVM1'/>
  3.             <target dev='hdb'/>
  4.         </disk>

Disk partition:

  1. <disk type='block' device='disk'>
  2.             <source dev='/dev/sda4'/>
  3.             <target dev='hdb' bus='ide'/>
  4.         </disk>

CD-ROM device:

  1. <disk type='block' device='cdrom'>
  2.             <source 'dev=/dev/sde'>
  3.             <target dev='hdb'/>
  4.             <readonly/>
  5.         </disk>

   14、使用網橋類型。確定每個kvm guest的mac位址唯一。将建立tun裝置,名稱為vnet x(x為0,1,2...)

  1. <interface type='bridge'>
  2.         <source bridge='br0'/>
  3.         <mac address="3B:6E:01:69:3A:11"/>
  4. </interface>

 補充:使用預設的虛拟網絡代替網橋,即guest為NAT模式。也可以省略mac位址元素,這樣将自動生成mac位址。

  1. <interface type='network'>
  2.             <source network='default'/>
  3.             <mac address="3B:6E:01:69:3A:11"/>
  4.         </interface>

 預設配置設定192.168.122.x/24的位址,也可以手動指定。網關為192.168.122.1

使用virtio: 采用普通的驅動,即硬碟和網卡都采用預設配置情況下,硬碟是 ide 模式,而網卡工作在 模拟的rtl 8139 網卡下,速度為100M 全雙工。采用 virtio 驅動後,網卡工作在 1000M 的模式下,硬碟工作是SCSI模式下。 rhel5.6 guest with virtio interface can not boot successfully if the system installation would use the ide interface https://bugzilla.redhat.com/show_bug.cgi?id=647387

  1. <interface type='bridge'>
  2.    <source bridge='br1'/>
  3.    <model type='virtio' />
  4. </interface>

性能:通過實體機上拷貝 普通驅動:26.1M virtio驅動:44.7M   因為交換機為100M,無法測試從其他實體機上拷貝。

 15、輸入裝置

  1. <input type='mouse' bus='ps2'/>

   16、定義與guset互動的圖形裝置。在這個例子中,使用vnc協定。listen的位址為host的位址。prot為-1,表示自動配置設定端口号,通過以下的指令查找端口号: virsh vncdisplay <KVM Guest Name>     注意:是passwd 而不是password  VNC is configured to listen on 127.0.0.1 by default. To make it listen on all public interfaces, edit /etc/libvirt/qemu.conf file.

  1. <graphics type='vnc' listen='221.191.134.123' passwd='123456' port='-1' autoport='yes' keymap='en-us'/>  

 17、裝置定義結束

  1. </devices>

18、KVM定義結束

  1. </domain>

  完整的xml

  1. <domain type='kvm'>
  2.   <name>centoskvm3</name>
  3.   <uuid>bdbb89fb-57d1-4d01-b3b7-ff33a9346ae6</uuid>
  4.   <memory>2048000</memory>
  5.   <currentMemory>1024000</currentMemory>
  6.   <vcpu>2</vcpu>
  7.   <os>
  8.     <type arch='x86_64' machine='pc'>hvm</type>
  9.     <boot dev='hd'/>
  10.   </os>
  11.   <features>
  12.     <acpi/>
  13.     <apic/>
  14.     <pae/>
  15.   </features>
  16.   <clock offset='localtime'/>
  17.   <on_poweroff>destroy</on_poweroff>
  18.   <on_reboot>restart</on_reboot>
  19.   <on_crash>destroy</on_crash>
  20.   <devices>
  21.     <emulator>/usr/libexec/qemu-kvm</emulator>
  22.     <disk type='file' device='disk' cache='none'>
  23.       <source file='/usr/local/kvm/centvm3.img'/>
  24.       <target dev='vda' bus='virtio'/>
  25.     </disk>
  26.     <interface type='bridge'>
  27.       <mac address='3b:6e:01:69:3a:11'/>
  28.       <source bridge='br0'/>
  29.       <model type='virtio'/>
  30.     </interface>
  31.     <input type='mouse' bus='ps2'/>
  32.     <graphics type='vnc' port='-1' autoport='yes' listen='221.196.131.121' keymap='en-us' passwd='123456'/>
  33.   </devices>
  34. </domain>

   1.2 用于從ISO啟動的XML檔案 virt-install --name vm1 --ram 512 --disk path=/usr/local/kvm/vm1/disk.os,size=10 --accelerate --cdrom= /usr/local/centos5.6/CentOS-5.6-x86_64-bin-DVD-1of2.iso  --vnc 0.0.0.0:3

  1. <domain type='kvm'>
  2.   <name>vmsample</name>
  3.   <uuid>fee1dfbb-a8f8-9144-d15a-852dbc175219</uuid>
  4.  <memory>2677721</memory>
  5.   <currentMemory>2677312</currentMemory>
  6.   <vcpu>2</vcpu>
  7.   <os>
  8.     <type arch='x86_64' machine='rhel5.4.0'>hvm</type>
  9.     <boot dev='cdrom'/>
  10.   </os>
  11.   <features>
  12.     <acpi/>
  13.     <apic/>
  14.     <pae/>
  15.   </features>
  16.   <clock offset='localtime'>
  17.     <timer name='pit' tickpolicy='delay'/>
  18.   </clock>
  19.   <on_poweroff>destroy</on_poweroff>
  20.   <on_reboot>destroy</on_reboot>
  21.   <on_crash>destroy</on_crash>
  22.   <devices>
  23.     <emulator>/usr/libexec/qemu-kvm</emulator>
  24.     <disk type='file' device='disk'>
  25.       <driver name='qemu' type='raw' cache='none'/>
  26.       <source file='/usr/local/kvm/vmsample/disk.os'/>
  27.         <target dev='vda' bus='virtio'/>
  28.     </disk>
  29.     <disk type='file' device='cdrom'>
  30.       <source file='/usr/local/centos5.6/CentOS-5.6-x86_64-bin-DVD-1of2.iso'/>
  31.       <target dev='hdb' bus='ide'/>
  32.       <readonly/>
  33.     </disk>
  34.     <interface type='bridge'>
  35.       <source bridge='br0'/>
  36.       <model type='virtio' />
  37.     </interface>
  38.     <interface type='bridge'>
  39.       <source bridge='br1'/>
  40.       <model type='virtio' />
  41.     </interface>
  42.     <input type='mouse' bus='ps2'/>
  43.     <graphics type='vnc' port='-1' autoport='yes' listen='1.1.1.1' passwd='11111v' keymap='en-us'/>
  44.     <video>
  45.       <model type='cirrus' vram='9216' heads='1'/>
  46.     </video>
  47.   </devices>
  48. </domain>

啟動後,磁盤空間為0?進入virsh ,etdi 虛拟機.xml,檢視磁盤類型,為raw?你建立的磁盤是qcow2?  四、 使用virsh建立一個kvm虛拟機  當建立或編輯了一個kvm xml檔案後,使用virsh tool建立kvm。  1、定義KVM virsh define <Name of XML definition file> For example: # virsh define /usr/local/kvm/centvm3.xml 在背景,這個指令拷貝該xml檔案到 /etc/libvirt/qemu目錄,檔案名為xml裡定義的kvm名稱。并且正式定義一個新的kvm。 如何修改? 方法1: virsh edit <Name of KVM> virsh define <Name of XML definition file> 方法2: virsh undefine <Name of KVM> virsh define <Name of XML definition file> 2、啟動KVM virsh start <Name of KVM> For example: # virsh start centosvm3 檢視vnc資訊: virsh vncdisplay centosvm3 也可以通過virt-viewer檢視 virt-viewer <Name of KVM> 關閉kvm虛拟機:virsh destory <Name of KVM> 檢視運作中的虛拟機: virsh list

3、克隆虛拟機 virt-clone -o vm1 -n vm2 -f /usr/local/kvm/vm2/disk.os /usr/local/kvm/vm2/disk.data -d --prompt 因為我的vm1虛拟機有兩個磁盤,是以,在克隆時需要制定兩個磁盤檔案,如果你不清楚順序,可以将-f部分去掉,後面的--prompt,互動式,可以根據提示輸入磁盤檔案。 注意:克隆的xml檔案會丢失vnc的passwd參數,需要手動添加。

克隆後,某個磁盤變為實際使用的大小? qemu-img create -F qcow2 -b ./disk.data.1 -f raw disk.data 80G

錯誤: 在convert 或 create時,報錯: qemu-img could not open 磁盤檔案 問題:當 qemu-img info 磁盤檔案存在backing file 項時,會報這個錯誤。 backing file 來源:當使用qemu-img create建立磁盤時,會建立這個項 另外:當虛拟機正在使用該磁盤時,qemu-img info 磁盤檔案時,也會出現這個錯誤。

關于qemu-img convert: 會建立新格式的磁盤,舊格式的磁盤仍然存在。

關于error: unknown OS type hvm kernel沒有加載子產品,檢查bios裡是否開啟了虛拟化

  雜項: 1、關閉guest的磁盤監控 # service smartd stop# chkconfig --del smartd

一篇不錯的文章: http://www.cyberciti.biz/faq/centos-rhel-linux-kvm-virtulization-tutorial/