Chinaunix首页 | 论坛 | 博客
  • 博客访问: 599065
  • 博文数量: 248
  • 博客积分: 52
  • 博客等级: 民兵
  • 技术积分: 1028
  • 用 户 组: 普通用户
  • 注册时间: 2012-12-23 12:05
文章分类

全部博文(248)

文章存档

2016年(7)

2013年(241)

分类: LINUX

2013-04-09 04:43:03

    KVM使用的是修改过的qemu,qemu以前使用过,不过都是用来装一个window使用,部门有vmware虚拟机的,现在KVM必须使用qemu了,就要多了解一下。
    qemu-kvm里面安装window没有问题,但是安装Asianux 3.0却难了我一把:安装换盘问题。
    安装Asianux 3.0需要三张盘安装完毕,以前用vmware时是有界面可以简单换盘(换iso文件),但是qemu就没有这么方便了,当然可以使用nfs的方式安装,不过那样就需要修改qemu默认的网络形式,这点我还是安排在后面再测试吧。
    在网上看到qemu中按alt+ctrl+2切换到qemu的命令模式,不过我试了一下,在我这环境中,QEMU PC emulator version 0.9.1,虽然可以切换到一个字符界面,但是没有(qemu)的shell,根本无法输入。在linux-kvm官网文档中,并没有提到如何切换到(qemu)的环境,只是说如何更换光盘。我还是在网上搜到了一个帖子,介绍的方法是可以的,我必须记住这个帖子的地址:http://hajali.blogspot.com/2007/12/qemu-change-cdrom.html
   

[root@fan3838 vm]# qemu-kvm -hda as31-1.img -cdrom Asianux-30-sp1-ia32-disc1-200810201446.iso -boot d -localtime -m 256 -monitor stdio
QEMU 0.9.1 monitor - type 'help' for more information
(qemu)


    起作用的是-monitor stdio参数。在(qemu)shell中更换光盘的方式,直接引用linux-kvm的文档介绍:

Qemu provides a way to change iso in the cdrom via the monitor interface.

QEMU 0.10.5 monitor - type 'help' for more information
(qemu)

The commands you'll want to use, info block, eject, and change. First we need to determine which block device is the cdrom you are interested in. Issue the info block command and look for cdrom devices.

(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]

ide1-cd0 is the only cdrom device in this example and there isn'
t any media inserted. To change the cdrom, we issue the change command supplying the device name (ide1-cd0) and the path to the new iso file.

(qemu) change ide1-cd0 /tmp/dsl-4.4.10.iso
(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 file=/tmp/dsl-4.4.10.iso ro=0 drv=raw encrypted=0
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu)

In case you already have a cdrom in the drive you need to eject the current iso first before issuing the change command. The eject command takes the name of the cdrom block device.

(qemu) eject ide1-cd0
(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu) change ide1-cd0 /tmp/fedora11.iso
(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 file=/tmp/fedora11.iso ro=0 drv=raw encrypted=0
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]

阅读(2025) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~