简体   繁体   English

为什么用qemu kvm打开.qcow2会很慢? 解决方案是什么?

[英]Why is it very slow to open a .qcow2 with qemu kvm? What's the solution?

I am openning a .qcow2 file using the command kvm -hda cloudera-quickstart-vm-4.4.0-1-kvm.qcow2 -net nic -net user -m 512 in Ubuntu 13.04 terminal but it's super slow and basically I have hard time having control over the cursor in the virtual machine. 我在Ubuntu 13.04终端使用命令kvm -hda cloudera-quickstart-vm-4.4.0-1-kvm.qcow2 -net nic -net user -m 512打开一个.qcow2文件,但它超级慢,基本上我很努力控制虚拟机中光标的时间。 Is there any better variant I can use for openning this .qcow2 file rather than qemu tools like kvm? 有没有更好的变种我可以用来打开这个.qcow2文件,而不是像kvm这样的qemu工具?

There could be two reasons: 可能有两个原因:

1) You probably were using IDE emulation instead of faster virtual hardware 1)您可能正在使用IDE仿真而不是更快的虚拟硬件

2) It could be that this is an old version of QEMU that defaulted to writethrough mode to avoid eating your data in case of power loss. 2)可能是这是QEMU的旧版本,默认为写入模式,以避免在断电时吃掉您的数据。

Both problems can be solved by replacing "-hda foo.qcow2" with "-drive if=virtio,file=foo.qcow2,cache=none". 通过将“-dda foo.qcow2”替换为“-drive if = virtio,file = foo.qcow2,cache = none”可以解决这两个问题。 On new-enough versions of QEMU you may not need ",cache=none". 在新版本的QEMU上,您可能不需要“,cache = none”。

In this special case, Cloudera had a vbox version of the VM so I downloaded it and used Virtual Box for playing the Virtual Machine and then in the Virtual Box setting I reduced the memory needed to 2GB instead of the default 4GB memory needed for this specific VM. 在这个特殊情况下, Cloudera有一个VMvbox版本,所以我下载它并使用Virtual Box播放Virtual Machine ,然后在Virtual Box设置中我将所需的内存减少到2GB而不是此特定所需的默认4GB内存VM。 Now everything is up and running. 现在一切都正常运行。

It could be because it is not using the KVM; 可能是因为它没有使用KVM; QEMU is emulator unlike qemu-kvm; QEMU是模拟器,与qemu-kvm不同; Make sure are your using kvm on running the virtual machine. 确保您在运行虚拟机时使用kvm。 To identify the virtual machine is enabled for kvm, run 要识别为kvm启用的虚拟机,请运行

[qemu] info kvm 
       kvm is enabled

on launching the qemu-kvm for the virtual machine; 启动虚拟机的qemu-kvm; if 'info kvm' shows kvm is disabled then you need to install the respective modules of kvm. 如果'info kvm'显示kvm被禁用,那么你需要安装相应的kvm模块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM