zoukankan      html  css  js  c++  java
  • virtio使用

    Windows

    参考文档

    下载virtio驱动

    下载地址

    如果是在Fedora或CentOS环境下,可使用yum的方式下载驱动

    [root@centos centos]#wget https://fedorapeople.org/groups/virt/virtio-win/virtio-win.repo -O /etc/yum.repos.d/virtio-win.repo
    [root@centos centos]# yum install virtio-win
    [root@centos centos]# rpm -ql virtio-win | grep iso
    /usr/share/virtio-win/virtio-win-0.1.102.iso
    /usr/share/virtio-win/virtio-win.iso
    

    安装virtio驱动

    • 将iso文件挂载到虚拟机上
    • 进入虚拟机并更新驱动
    驱动名称 设备名称 说明
    Balloon PCI standard RAM Controller PCI标准内存控制器
    vioserial PCI Simple Communication Controller PCI简易通信控制器
    NetKVM Network adapters 网络适配器
    viostor Disk drives 磁盘驱动(安装虚拟机操作系统的磁盘一开始只能使用IDE,所以安装不了viostor驱动,这时候需要额外添加一个qcow2的磁盘,用来安装viostor驱动)

    修改虚拟机配置

    • 关闭虚拟机
    • 修改磁盘总线
    # 修改前
    <disk type='file' device='disk'>
       <source file='/var/lib/libvirt/images/disk1.img'/>
       <target dev='hda' bus='ide'/>
    </disk>
    # 修改后
    <disk type='file' device='disk'>
       <source file='/var/lib/libvirt/images/disk1.img'/>
       <target dev='vda' bus='virtio'/>
    </disk>
    

    Linux

    测试virtio模块是否存在

    [centos@centos ~]$ sudo modprobe virtio
    [centos@centos ~]$ sudo modprobe virtio_ring
    [centos@centos ~]$ sudo modprobe virtio_pci
    [centos@centos ~]$ sudo modprobe virtio_blk
    [centos@centos ~]$ sudo modprobe virtio_net
    [centos@centos ~]$ lsmod |grep virt
    virtio_net             28024  0 
    virtio_blk             18156  0 
    virtio_pci             22913  0 
    virtio_ring            21524  3 virtio_blk,virtio_net,virtio_pci
    virtio                 15008  3 virtio_blk,virtio_net,virtio_pci
    

    编辑/etc/rc.d/rc.sysinit文件

    if [ -f /etc/rc.modules ]; then
      /etc/rc.modules
    fi
    
    modprobe virtio
    modprobe virtio_ring # Comment this out if you do not need block driver
    modprobe virtio_blk  # Comment this out if you do not need block driver
    modprobe virtio_net  # Comment this out if you do not need net driver
    modprobe virtio_pci
    

    设置Network性能

    禁用GSO和TSO选项

    [centos@centos ~]$ ethtool -K interface gso off
    [centos@centos ~]$ ethtool -K interface tso off
    

    编辑/etc/fstab文件设置swap分区名

    修改hd*vd*

    修改虚拟机配置

    • 关闭虚拟机
    • 修改磁盘总线
    # 修改前
    <disk type='file' device='disk'>
       <source file='/var/lib/libvirt/images/disk1.img'/>
       <target dev='hda' bus='ide'/>
    </disk>
    # 修改后
    <disk type='file' device='disk'>
       <source file='/var/lib/libvirt/images/disk1.img'/>
       <target dev='vda' bus='virtio'/>
    </disk>
    
  • 相关阅读:
    解决安装postgresql安装报An error occurred executing the Microsoft C++ runtime installer.问题
    使用U盘为龙芯笔记本安装操作系统
    年终复盘与展望(2017年)
    年终复盘与展望(2016年)
    Spark log4j 配置
    R语言码农的Scala学习心得
    在集群上运行Spark应用
    通过 Spark R 操作 Hive
    CentOS 6.7 hadoop free版本Spark 1.6安装与使用
    OS X Maven 安装与使用简介
  • 原文地址:https://www.cnblogs.com/silvermagic/p/7666153.html
Copyright © 2011-2022 走看看