今回は物理 USB デバイスが実際に無い状態でも Nested ESXi 上で
仮想 USB デバイスが使用できるようにする方法について記載します。
Nested ESXi に仮想 USB デバイスとエミュレートする方法
本手順では、既にインストール済みの Nested ESXi に仮想 USB デバイス
を認識させます。
まずは、Nested ESXi をシャットダウンし、仮想マシンの編集から
USB コントローラを追加します。
![](https://ss-engineer.com/wp-content/uploads/2023/03/22b44803aa7928c86ab21c04aa1756ff-1024x799.png)
次に、以下コマンドを実行し、Nested ESXi の仮想マシンフォルダ上に
仮想ディスクファイルを作成します。
vmkfstools -c 16G /vmfs/volumes/datastore1/ESXi7.0U3_01/usb.vmdk
仮想ディスクファイル作成後に、Nested ESXi の vmx ファイルを編集し、
以下を追加します。
usb_xhci:0.present = "TRUE"
usb_xhci:0.deviceType = "disk"
usb_xhci:0.fileName = "usb.vmdk"
usb_xhci:0.readOnly = "FALSE"
usb_xhci:0.speed = "16"
usb_xhci:0.parent = "-1"
usb_xhci:0.port = "0"
上記パラメーターを追加後、以下コマンドにて vmx のリロードを行います。
vim-cmd vmsvc/reload $(vim-cmd vmsvc/getallvms | grep 'ESXi7.0U3_01' | awk '{print $1}')
設定は以上となるため、仮想マシンをパワーオンした後に USB デバイス
が認識されていれば問題ありません。
![](https://ss-engineer.com/wp-content/uploads/2023/03/766d017eff5a604b89388e30de038b86.png)
![](https://ss-engineer.com/wp-content/uploads/2023/03/54618cb15517a11f53248510bcc0e947-1024x800.png)
<参考>
Emulating a Virtual USB storage device using Nested ESXi
https://williamlam.com/2022/07/emulating-a-virtual-usb-storage-device-using-nested-esxi.html
ESXi 上から USB デバイスを確認してみる
デフォルトのままだと ESXi は USB デバイスをパススルーデバイスとして認識
しているため、vSphere Client/Host Client 上での [ストレージデバイス] や
esxcli storage core device list コマンドなどからは確認することができません。
パススルーデバイスとして USB デバイスを確認したい場合は、以下のコマンド
にて確認することが可能です。
[root@esxi:~] esxcli hardware usb passthrough device list
Bus Dev VendorId ProductId Enabled Can Connect to VM Name
--- --- -------- --------- ------- ----------------- ----
1 2 e0f 5 true yes VMware, Inc. Virtual Mass Storage
ストレージデバイスとして認識させたい場合は、以下コマンドを使用して
usbarbitrator サービスを停止させる必要があります。
/etc/init.d/usbarbitrator stop
usbarbitrator サービスを停止すると、vSphere Client/Host Client 上での
[ストレージデバイス] や esxcli storage core device list コマンドにて
USB デバイスが見えるようになります。
![](https://ss-engineer.com/wp-content/uploads/2023/03/fab7411aa21e98239831843f3f20a3bc-1024x196.png)
[root@esxi:~] esxcli storage core device list
mpx.vmhba32:C0:T0:L0
Display Name: Local USB Direct-Access (mpx.vmhba32:C0:T0:L0)
Has Settable Display Name: false
Size: 16384
Device Type: Direct-Access
Multipath Plugin: NMP
Devfs Path: /vmfs/devices/disks/mpx.vmhba32:C0:T0:L0
Vendor: VMware
Model: Virtual USB Mass
Revision: 0100
SCSI Level: 2
Is Pseudo: false
Status: on
Is RDM Capable: false
Is Local: true
Is Removable: true
Is SSD: false
Is VVOL PE: false
Is Offline: false
Is Perennially Reserved: false
Queue Full Sample Size: 0
Queue Full Threshold: 0
Thin Provisioning Status: unknown
Attached Filters:
VAAI Status: unsupported
Other UIDs: vml.0000000000766d68626133323a303a30
Is Shared Clusterwide: false
Is SAS: false
Is USB: true
Is Boot Device: false
Device Max Queue Depth: 1
No of outstanding IOs with competing worlds: 1
Drive Type: unknown
RAID Level: unknown
Number of Physical Drives: unknown
Protection Enabled: false
PI Activated: false
PI Type: 0
PI Protection Mask: NO PROTECTION
Supported Guard Types: NO GUARD SUPPORT
DIX Enabled: false
DIX Guard Type: NO GUARD SUPPORT
Emulated DIX/DIF Enabled: false