美文网首页
Create VMFS Datastore on USB dri

Create VMFS Datastore on USB dri

作者: 龙天ivan | 来源:发表于2018-02-02 21:37 被阅读110次

    Create VMFS Datastore on USB drives

    1. Connect to the ESXi host with SSH
    2. Stop the USB arbitrator service. This service is used to passthrough USB device from an ESX/ESXi host to a virtual machine. (When disabling it, you can no longer passthrough USB devices to VMs)
    ~ # /etc/init.d/usbarbitrator stop
    
    1. (optional) Use this command to permanently disable the USB arbitrator service after reboot.
    ~ # chkconfig usbarbitrator off
    
    1. Plug in the USB Device to your ESXi host
    2. Get the device identifier (mpx.vmhbaXX). You should see the USB Device in /dev/disks/:
    ~ # ls /dev/disks/
    
    1. Write a GPT label to the device (Assuming that the Device ID is mpx.vmhba36)
    ~ # partedUtil mklabel /dev/disks/mpx.vmhba36\:C0\:T0\:L0 gpt
    
    1. To create a partition you need to know the start sector, end sector, which depends on the device size and the GUID.
      The start sector is always 2048
      The GUID for VMFS is AA31E02A400F11DB9590000C2911D1B8 The end sector can be calculated with the following formula (Use the numbers from getptbl):
    ~ # partedUtil getptbl /dev/disks/mpx.vmhba36\:C0\:T0\:L0
        gpt
        1947 255 63 31293440
    

    1947 * 255 * 63 - 1 = 31278554

    You can also calculate the endsector with the following command:

    ~ # eval expr $(partedUtil getptbl /dev/disks/mpx.vmhba36\:C0\:T0\:L0 | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
        31278554
    
    1. Create the VMFS partition (Replace with your endsector)
    ~ # partedUtil setptbl /dev/disks/mpx.vmhba36\:C0\:T0\:L0 gpt "1 2048 31278554 AA31E02A400F11DB9590000C2911D1B8 0"
    
    1. Format the partition with VMFS5
    ~ # vmkfstools -C vmfs5 -S USB-Stick /dev/disks/mpx.vmhba36\:C0\:T0\:L0:1
    

    The USB-Stick should now appear in your datastores view.


    vmfs-formatted-usb-stick

    And the final proof is a virtual machine running on it:


    vm-running-on-usb-stick

    This is how your command output should look like:

    ~ # partedUtil mklabel /dev/disks/mpx.vmhba43\:C0\:T0\:L0 gpt
    ~ # eval expr $(partedUtil getptbl /dev/disks/mpx.vmhba43\:C0\:T0\:L0 | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
    31278554
    ~ # partedUtil setptbl /dev/disks/mpx.vmhba43\:C0\:T0\:L0 gpt "1 2048 31278554 AA31E02A400F11DB9590000C2911D1B8 0"
    gpt
    0 0 0 0
    1 2048 31278554 AA31E02A400F11DB9590000C2911D1B8 0
    ~ # vmkfstools -C vmfs5 -S USB-Stick /dev/disks/mpx.vmhba43\:C0\:T0\:L0:1
    create fs deviceName:'/dev/disks/mpx.vmhba43:C0:T0:L0:1', fsShortName:'vmfs5', fsName:'USB-Stick'
    deviceFullPath:/dev/disks/mpx.vmhba43:C0:T0:L0:1 deviceFile:mpx.vmhba43:C0:T0:L0:1
    ATS on device /dev/disks/mpx.vmhba43:C0:T0:L0:1: not supported
    .
    Checking if remote hosts are using this device as a valid file system. This may take a few seconds...
    Creating vmfs5 file system on "mpx.vmhba43:C0:T0:L0:1" with blockSize 1048576 and volume label "USB-Stick".
    Successfully created new volume: 56226b60-118f2e3f-04ba-001b2193b3b0
    

    Performance

    You cant expect much performance out of usb flash drives. To see what's possible I've connected a Samsung mSATA SSD (840 EVO 250GB) to my Intel NUCs (NUC5i5MYHE) USB3 port and created a VMFS datastore on it.


    intel-nuc-with-usb3-connected-ssd

    Unfortunatelly it's detected as USB 2 device. There is a USB 3.0 hub, but it is not utilized. That seems to be a common problem, I don't know if it's actually possible at the moment.

    [Update: October 19. 2015 - Figured out why devices are detected as USB 2. Devices now with full USB 3.0 performance. Performance test results updated.]

    Max Write Throughput: 301.91 MB/s
    Max Read Throughput: 308.78 MB/s
    Max Write IOPS: 8159.31 CMDS/s Max Write IOPS:** 8228.49 CMDS/s**

    Throughput Test:

    vmware-io-analyzer-1.5.1-max-read-throughput vmware-io-analyzer-1.5.1-max-write-throughput
    IOPS Test:
    vmware-io-analyzer-1.5.1-max-read-iops vmware-io-analyzer-1.5.1-max-write-iops

    Mixed IO Test (I/O Analyzer Exchange 2007):

    vmware-io-analyzer-1.5.1-exchange-2007-iops [ vmware-io-analyzer-1.5.1-exchange-2007-throughput

    (see more from:http://www.virten.net/2015/10/usb-devices-as-vmfs-datastore-in-vsphere-esxi-6-0/)

    相关文章

      网友评论

          本文标题:Create VMFS Datastore on USB dri

          本文链接:https://www.haomeiwen.com/subject/yscyzxtx.html