kvm 上的 sata

最後更新: 2020-02-13

 

 


Disk Passthrough

 

有 XML

<disk type='block' device='disk'>
    <driver name='qemu' type='raw' cache='none'/>
    <source dev='/dev/disk/by-id/ata-WDC_WD2002FAEX-007BA0_WD-WMAWP0493116'/>
    <target dev='sdf' bus='sata'/>
</disk>

注意 !!

[1]

"dev=" 不可以用 /dev/sdc, 因為此代號有機會改變

ls -al  /dev/disk/by-id/ata-WDC_WD2002FAEX-007BA0_WD-WMAWP0493116

... /dev/disk/by-id/ata-WDC_WD2002FAEX-007BA0_WD-WMAWP0493116 -> ../../sdc

[1]

小心 hypervisor 的 MD 及 LVM 偵測, 因為它會影響 VM 的 Disk !!

 


ATA 的次序

 

有 XML

    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source dev='/dev/disk/by-id/ata-WDC_WD2002FAEX-007BA0_WD-WMAWP0493116'/>
      <target dev='sdf' bus='sata'/>
      <address type='drive' controller='0' bus='0' target='0' unit='5'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source dev='/dev/disk/by-id/ata-WDC_WD2002FAEX-007BA0_WD-WMAWP0494690'/>
      <target dev='sdg' bus='sata'/>
      <address type='drive' controller='1' bus='0' target='0' unit='0'/>
    </disk>

controller 0 不會比 controller 1 排先, 因為它們的次序是可以設定的

    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <controller type='sata' index='1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </controller>