最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

kvm?透?jìng)黠@卡至win10虛擬機(jī)的方法

 更新時(shí)間:2022年09月22日 16:11:02   作者:lixinliang  
這篇文章主要介紹了kvm?透?jìng)黠@卡至win10虛擬機(jī),本文通過命令腳本實(shí)例代碼相結(jié)合給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

環(huán)境

 已安裝nvidia   顯卡  驅(qū)動(dòng)
  操作系統(tǒng):CentOS Linux release 7.9.2009 (Core)
  內(nèi)核版本:Linux 5.4.135-1.el7.elrepo.x86_64
  顯卡   型號(hào):rtx 6000
  
  kvm版本:
  virsh version
  Compiled against library:   libvirt   4.5.0
  Using library:   libvirt   4.5.0
  Using   API  : QEMU 4.5.0
  Running hypervisor: QEMU 1.5.3

解綁GPU 設(shè)備

1.配置GRUB_CMDLINE_LINUX(實(shí)測(cè),有效),查詢要解綁的設(shè)備,記錄設(shè)備id號(hào)

lspci  -nn|grep   NVIDIA |grep VGA
或者 lspci  -nn|grep   NVIDIA

2.修改 /etc/default/grub文件的GRUB_CMDLINE_LINUX

vi /etc/default/grub 
以下是內(nèi)容,新增加 GRUB_CMDLINE_LINUX行: intel_iommu=on pci-stub.ids=10de:1e30" 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="intel_iommu=on crashkernel=auto spectre_v2=retpoline rhgb quiet rdblacklist=nouveau pci-stub.ids=10de:1e30"
GRUB_DISABLE_RECOVERY="true"

3.更新grub2 conf,執(zhí)行如下命令

grub2-mkconfig -o /boot/grub2/grub.cfg

4.重啟系統(tǒng)

reboot

驗(yàn)證并查看nvidia 顯卡

1.執(zhí)行nvidia-smi ,看不到顯卡,證明顯卡已經(jīng)被解綁

# nvidia-smi 
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

2.驗(yàn)證內(nèi)核支持iommu

cat /proc/cmdline | grep iommu 
結(jié)果輸出: intel_iommu=on

3.驗(yàn)證VT-D是否啟用

dmesg |grep -e DMAR -e IOMMU

安裝win10虛擬機(jī)

qemu-img create -f qcow2  /home/kvm-machines/shaoyan.qcow2  200G
virt-install --name shaoyan --ram 4096 --vcpus=8 --os-type=windows --accelerate --cdrom=/home/kvm_images/win10.iso   --disk path=/home/kvm-machines/shaoyan.qcow2,format=qcow2,bus=ide --bridge=br0  --autostart --vnc --vncport=5910 --vnclisten=0.0.0.0 

宿主機(jī)安裝軟件包

yum -y groups install 'GNOME Desktop'  virt-manager virt-viewer dejavu-lgc-sans-fonts 

顯卡加載vfio驅(qū)動(dòng)
1.顯卡加載vfio驅(qū)動(dòng)

modprobe vfio
modprobe vfio-pci

2.從服務(wù)器卸載1張顯卡的4個(gè)設(shè)備

virsh nodedev-detach pci_0000_b1_00_0
virsh nodedev-detach pci_0000_b1_00_1
virsh nodedev-detach pci_0000_b1_00_2
virsh nodedev-detach pci_0000_b1_00_3

3.驗(yàn)證顯卡設(shè)備是否加載vfio-pci驅(qū)動(dòng),加載成功

# lspci -vv -s b1:00.0 | grep driver
        Kernel driver in use: vfio-pci
[root@rtx_6000 10.147.100.107 ~ ]
# lspci -vv -s b1:00.1 | grep driver
        Kernel driver in use: vfio-pci
[root@rtx_6000 10.147.100.107 ~ ]
# lspci -vv -s b1:00.2 | grep driver
        Kernel driver in use: vfio-pci
[root@rtx_6000 10.147.100.107 ~ ]
# lspci -vv -s b1:00.3 | grep driver
        Kernel driver in use: vfio-pci

win10虛擬機(jī)添加NVDIA顯卡
1.通過遠(yuǎn)控卡登錄服務(wù)器透?jìng)黠@卡,執(zhí)行startx 調(diào)出可視化頁面

startx

2.添加顯卡硬件

3.查看顯卡

顯卡驅(qū)動(dòng)安裝
1.要安裝顯卡驅(qū)動(dòng),需要修改虛擬機(jī)win10的配置文件 否則顯卡驅(qū)動(dòng)安裝過程中自檢會(huì)報(bào)錯(cuò)ERROR CODE 43,驅(qū)動(dòng)不允許安裝在虛擬機(jī)上。

#編輯VM XML
virsh edit shaoyan

#修改第一行
<domain type='kvm'>
#為
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>

#找到<features>節(jié)點(diǎn),添加內(nèi)容
<features>
... 
  <kvm><hidden state='on'/></kvm>
...
</features>

#找到</device>節(jié)點(diǎn),在device后添加內(nèi)容
<qemu:commandline><qemu:arg value='-cpu'/><qemu:arg value='host,hv_time,kvm=off,hv_vendor_id=null'/>
</qemu:commandline>

#重啟VM
virsh destroy shaoyan
virsh start shaoyan

2.附錄完整xml 文件如下,如果是拷貝至其他宿主機(jī)配置文件的話,只需要保留xml 文件中的第一組hostdev即可,否則會(huì)報(bào)錯(cuò)

# cat /etc/libvirt/qemu/shaoyan.xml

<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
  virsh edit shaoyan
or other application using the libvirt API.
-->

<domain type='kvm'>
  <name>shaoyan</name>
  <uuid>e06c6c3b-0a57-43e8-9d6f-02fd1e2aad83</uuid>
  <title>gpu</title>
  <description>gpu</description>
  <memory unit='KiB'>16777216</memory>
  <currentMemory unit='KiB'>16777216</currentMemory>
  <vcpu placement='static'>16</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough' check='none'/>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
    <timer name='hypervclock' present='yes'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/data/kvm/shaoyan.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:48:b2:5a'/>
      <source bridge='br0'/>
      <model type='e1000'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='5910' autoport='no' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vga' vram='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0xb1' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0xb1' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0xb1' slot='0x00' function='0x2'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0xb1' slot='0x00' function='0x3'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
</domain>

3.登錄win10 虛擬機(jī)配置網(wǎng)絡(luò)

4.安裝驅(qū)動(dòng),選擇具體型號(hào)進(jìn)行下載并安裝驅(qū)動(dòng)

https://www.nvidia.cn/Download/index.aspx?lang=cn

5.查看顯卡設(shè)備

至此,win10通過kvm虛擬化透?jìng)鱃PU 顯卡完成!

到此這篇關(guān)于kvm 透?jìng)黠@卡至win10虛擬機(jī)的文章就介紹到這了,更多相關(guān)kvm 透?jìng)黠@卡win10虛擬機(jī)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 詳細(xì)介紹kvm虛擬機(jī)靜態(tài)和動(dòng)態(tài)遷移(圖文介紹)

    詳細(xì)介紹kvm虛擬機(jī)靜態(tài)和動(dòng)態(tài)遷移(圖文介紹)

    本篇文章主要詳細(xì)介紹kvm虛擬機(jī)靜態(tài)和動(dòng)態(tài)遷移,具有一定的參考價(jià)值,有需要的可以了解一下。
    2016-11-11
  • KVM虛擬化安裝部署及管理教程

    KVM虛擬化安裝部署及管理教程

    這篇文章主要為大家介紹了KVM虛擬化,kvm的安裝部署及管理教程,文中示例過程 非常詳細(xì),有需要的朋友可以借鑒參考下,希望能夠有所幫助
    2021-10-10
  • kvm虛擬化學(xué)習(xí)筆記(一)之kvm虛擬化環(huán)境安裝的步驟

    kvm虛擬化學(xué)習(xí)筆記(一)之kvm虛擬化環(huán)境安裝的步驟

    這篇文章主要介紹了kvm虛擬化學(xué)習(xí)筆記(一)之kvm虛擬化環(huán)境安裝的步驟,非常具有實(shí)用價(jià)值,需要的朋友可以參考下。
    2016-12-12
  • KVM基礎(chǔ)命令詳解

    KVM基礎(chǔ)命令詳解

    使用?KVM?可允許多個(gè)包括?Linux?和?Windows?每個(gè)虛擬機(jī)有私有的硬件,包括網(wǎng)卡、磁盤以及圖形適配卡,今天通過本文給大家介紹下KVM基礎(chǔ)命令,感興趣的朋友一起看看吧
    2022-04-04
  • Centos7之KVM虛擬化基礎(chǔ)管理詳解

    Centos7之KVM虛擬化基礎(chǔ)管理詳解

    這篇文章主要介紹了Centos7之KVM虛擬化基礎(chǔ)管理詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-10-10
  • KVM?介紹及作用詳解

    KVM?介紹及作用詳解

    KVM?全稱是基于內(nèi)核的虛擬機(jī)(Kernel-based?Virtual?Machine),它是Linux?的一個(gè)內(nèi)核模塊,今天通過本文給大家介紹KVM的基本知識(shí),感興趣的朋友一起看看吧
    2022-03-03
  • Centos7下搭建KVM虛擬機(jī)的方法

    Centos7下搭建KVM虛擬機(jī)的方法

    本篇文章主要介紹了Centos7下搭建KVM虛擬機(jī)的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧。
    2017-03-03
  • CentOS 7中搭建KVM虛擬化平臺(tái)的方法步驟

    CentOS 7中搭建KVM虛擬化平臺(tái)的方法步驟

    這篇文章主要介紹了CentOS 7中搭建KVM虛擬化平臺(tái)的方法步驟,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-08-08
  • 在CentOS7搭建KVM虛擬化平臺(tái)(三種方式)

    在CentOS7搭建KVM虛擬化平臺(tái)(三種方式)

    這篇文章主要介紹了在CentOS7搭建KVM虛擬化平臺(tái)(三種方式),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-11-11
  • KVM虛擬化(一)——KVM虛擬機(jī)的介紹與簡(jiǎn)單使用

    KVM虛擬化(一)——KVM虛擬機(jī)的介紹與簡(jiǎn)單使用

    本篇文章主要介紹了KVM虛擬機(jī)的介紹與簡(jiǎn)單使用,具有一定的參考價(jià)值,有興趣的可以了解一下。
    2016-11-11

最新評(píng)論

雷州市| 连州市| 雅江县| 德清县| 长顺县| 昭苏县| 绥芬河市| 民丰县| 武山县| 麻江县| 黎川县| 偏关县| 包头市| 东丰县| 建阳市| 响水县| 格尔木市| 拜城县| 宜丰县| 元江| 桃园市| 孟津县| 西宁市| 江口县| 高州市| 涞水县| 三原县| 宜州市| 炎陵县| 南投市| 锡林郭勒盟| 乐平市| 房产| 九寨沟县| 依安县| 花莲市| 保定市| 宜宾县| 镇雄县| 长兴县| 濉溪县|