首页 > 代码库 > 安装kvm虚拟机报错,解决办法

安装kvm虚拟机报错,解决办法

创建虚拟磁盘文件

[root@vmware2 ~]# qemu-img create -f qcow2 -o preallocation=metadata dev_beyond.img 8G 

Formatting ‘dev_beyond.img‘, fmt=qcow2 size=8589934592 encryption=off cluster_size=65536 preallocation=‘metadata‘

参数说明: -o preallocation=metadata 预分配磁盘,磁盘空间不会立即占用

注意:ext3不支持此参数,ext4支持。

安装虚拟机命令参数

[root@vmware2 ~]# virt-install --name=dev_beyond --ram 512 --vcpus=1 -f /root/dev_beyond.img --cdrom=/iso/Centos6.iso --graphics vnc,listen=0.0.0.0,port=7777, --force --autostart


Starting install...

ERROR    internal error Process exited while reading console log output: char device redirected to /dev/pts/1

qemu-kvm: -drive file=/root/dev_beyond.img,if=none,id=drive-ide0-0-0,format=raw,cache=none: could not open disk image /root/dev_beyond.img: Permission denied


Domain installation does not appear to have been successful.

If it was, you can restart your domain by running:

  virsh --connect qemu:///system start dev_beyond

otherwise, please restart your installation.


解决办法:把-o preallocation=metadata去掉即可。

[root@vmware2 ~]# qemu-img create -f qcow2 /data/vmdisk/beyond.qcow2 8G      

Formatting ‘/data/vmdisk/beyond.qcow2‘, fmt=qcow2 size=8589934592 encryption=off cluster_size=65536 

[root@vmware2 ~]# virt-install --name=dev_beyond --ram 512 --vcpus=1 -f /data/vmdisk/beyond.qcow2 --cdrom=/iso/Centos6.iso --graphics vnc,listen=0.0.0.0,port=7777, --force --autostart                   


Starting install...

Creating domain...                                                                |    0 B     00:03     

Cannot open display: 

Run ‘virt-viewer --help‘ to see a full list of available command line options

Domain installation still in progress. You can reconnect to 

the console to complete the installation process.

wKioL1PrKgfi7HWdAAFSYyPfsDg746.jpg

本文出自 “岁月在流逝,光辉依然在” 博客,请务必保留此出处http://taokey.blog.51cto.com/4633273/1539562