USB HDDをESXiのデータストアとして使う
Qiitaとかに山ほど情報が乗っているので説明は割愛します。
環境はこんな感じ
- ESXi6.7 Update1
- USB-HDDケース:LGB-EKU3
- HDD:WD20EARX(2TB)
USB接続されていることを確認
[root@xxx:~] lsusb Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 003 Device 002: ID 0789:0282 Logitec Corp. Bus 003 Device 001: ID 0e0f:8003 VMware, Inc. Bus 002 Device 001: ID 0e0f:8002 VMware, Inc. Bus 001 Device 001: ID 0e0f:8002 VMware, Inc.
NAS(Shuttle KD20)に接続していたHDDなので、パーティションが見えてます。
[root@xxx:~] ls /dev/disks/ t10.ATA_____SanDisk_SDMSATA512G_____________________162225400255________ vml.0100000000313632323235343030323535202020202020202053616e446973 t10.ATA_____SanDisk_SDMSATA512G_____________________162225400255________:1 vml.0100000000313632323235343030323535202020202020202053616e446973:1 t10.ATA_____SanDisk_SDMSATA512G_____________________162225400255________:2 vml.0100000000313632323235343030323535202020202020202053616e446973:2 t10.ATA_____SanDisk_SDMSATA512G_____________________162225400255________:3 vml.0100000000313632323235343030323535202020202020202053616e446973:3 t10.ATA_____SanDisk_SDMSATA512G_____________________162225400255________:5 vml.0100000000313632323235343030323535202020202020202053616e446973:5 t10.ATA_____SanDisk_SDMSATA512G_____________________162225400255________:6 vml.0100000000313632323235343030323535202020202020202053616e446973:6 t10.ATA_____SanDisk_SDMSATA512G_____________________162225400255________:7 vml.0100000000313632323235343030323535202020202020202053616e446973:7 t10.ATA_____SanDisk_SDMSATA512G_____________________162225400255________:8 vml.0100000000313632323235343030323535202020202020202053616e446973:8 t10.ATA_____SanDisk_SDMSATA512G_____________________162225400255________:9 vml.0100000000313632323235343030323535202020202020202053616e446973:9 t10.Logitec_________________0123456789ABCDEF vml.020000000030880000001221004c4742205553 t10.Logitec_________________0123456789ABCDEF:1 vml.020000000030880000001221004c4742205553:1 t10.Logitec_________________0123456789ABCDEF:2 vml.020000000030880000001221004c4742205553:2 t10.Logitec_________________0123456789ABCDEF:3 vml.020000000030880000001221004c4742205553:3 t10.Logitec_________________0123456789ABCDEF:4 vml.020000000030880000001221004c4742205553:4
usbarbitatorを止める
ゲストにUSBデバイスを見せないように設定を変更
[root@xxx:~] /etc/init.d/usbarbitrator stop UsbUtil: Releasing all USB adapters to VMkernel watchdog-usbarbitrator: Terminating watchdog process with PID 2098232 usbarbitrator stopped
自動起動しないように設定変更
[root@xxx:~] chkconfig usbarbitrator off
VMFSパーティション作成
GPTラベルをセット
[root@xxx:~] partedUtil mklabel /dev/disks/t10.Logitec_________________0123456789ABCDEF gpt
適当にVMFSパーティションを作成
容量計算が面倒なので1GB分作成(小さすぎるとフォーマットに失敗します)
[root@xxx:~] partedUtil setptbl /dev/disks/t10.Logitec_________________0123456789ABCDEF gpt "1 2048 20480000 AA31E02A400F11DB9590000C2911D1B8 0" gpt 0 0 0 0 1 2048 20480000 AA31E02A400F11DB9590000C2911D1B8 0
VMFS6でフォーマット
[root@xh61v:~] vmkfstools -C vmfs6 -S USB_Datastore /dev/disks/t10.Logitec_________________0123456789ABCDEF:1 create fs deviceName:'/dev/disks/t10.Logitec_________________0123456789ABCDEF:1', fsShortName:'vmfs6', fsName:'USB_Datastore' deviceFullPath:/dev/disks/t10.Logitec_________________0123456789ABCDEF:1 deviceFile:t10.Logitec_________________0123456789ABCDEF:1 ATS on device /dev/disks/t10.Logitec_________________0123456789ABCDEF:1: not supported . Checking if remote hosts are using this device as a valid file system. This may take a few seconds... Creating vmfs6 file system on "t10.Logitec_________________0123456789ABCDEF:1" with blockSize 1048576, unmapGranularity 1048576, unmapPriority default and volume label "USB_Datastore". Successfully created new volume: 5bfeadb0-69702dbf-211c-80ee735d7d52
HostUIから適当にリサイズ
ここまでやっていればHostUIからも弄れるようになっています。
作成したデータストアを容量拡張したら終わりです。
参考にさせていただいたサイト
USB Devices as VMFS Datastore in vSphere ESXi 6.5 | Virten.net