{"id":603,"date":"2016-08-14T17:45:09","date_gmt":"2016-08-14T21:45:09","guid":{"rendered":"https:\/\/ithinkvirtual.com\/?p=603"},"modified":"2018-02-10T09:33:36","modified_gmt":"2018-02-10T14:33:36","slug":"create-vmfs5-datastore-on-a-usb-drive","status":"publish","type":"post","link":"https:\/\/ithinkvirtual.com\/2016\/08\/14\/create-vmfs5-datastore-on-a-usb-drive\/","title":{"rendered":"How To: Create A VMFS5 Datastore On A USB Drive"},"content":{"rendered":"

Create A VMFS5 Datastore On A USB Drive<\/strong><\/em><\/p>\r\n

Ever wondered if it was possible to use a USB Drive as a VMFS5 datastore in VMware vSphere 6.0? \u00a0I sure know that I have! \u00a0Not that I would like to run any VM’s on said datastore, as I’m sure performance would not be optimal, but instead to test its functionality and use it for storing ESXi host logs for example. \u00a0Well, I ran into an issue today where I needed to unmount all of my NFS mounts on ESXi 6.0 U2 in order to recreate some of the volumes before remounting them. \u00a0The problem was that I was unable to unmount one of my volumes because it was bound to the ESXi host for scratch logs. \u00a0As I didn’t have a spare drive of any sort to attach to my host so that I could reconfigure the location for scratch logs, I began tinkering with the idea of using a small USB drive as a temporary datastore for these logs.<\/p>\r\n

After doing a little research, I came across a post from Florian Grehl<\/a> aka @virten<\/a>\u00a0 showing exactly how to accomplish this so I figured I’d share the process of doing so. \u00a0Keep in mind that this should only be used for testing purposes and should not be used in production environments. \u00a0This is unsupported by VMware. \u00a0Here we go!<\/p>\r\n

Ensure that the USB device is\u00a0unplugged from the ESXi host then begin by connecting to your ESXi host and stopping the USB arbitrator service. \u00a0This service is responsible for allowing USB device passthrough from an ESXi host to a virtual machine, so keep in mind that you will no longer be able to pass through USB devices to VM’s until this is restarted. \u00a0(Note: restarting service after creating and mounting USB datastore will break connectivity and recognition of the USB datastore). \u00a0\u00a0To stop the service, run the following command:<\/p>\r\n

\/etc\/init.d\/usbarbitrator stop<\/pre>\r\n

\"2016-08-11_17-12-19\"<\/a>\"2016-08-11_17-12-35\"<\/a><\/p>\r\n

Optionally, if you’d like to permanently disable the service so it persists thru reboots, run the following command:<\/p>\r\n

chkconfig usbarbitrator off<\/pre>\r\n

Plug the USB drive into your ESXi host. \u00a0For the purposes of this tutorial, I am using a small Lexar 8GB USB device. \u00a0If you navigate to the storage\u00a0devices section on your host, you should now see the connected USB device is recognized by the hypervisor. \u00a0Make note of the device identifier number (mpx.vmhbaXX) for this device.<\/p>\r\n

vSphere Client:<\/p>\r\n

\u00a0\"2016-08-14_16-53-34\"<\/a><\/p>\r\n

vSphere Web Client:<\/p>\r\n

\"2016-08-14_17-02-22\"<\/a><\/p>\r\n

vSphere HTML5 Web Client:<\/p>\r\n

\"2016-08-14_17-02-44\"<\/a><\/p>\r\n

You can also list the device information to determine the identifier by running the following command:<\/p>\r\n

ls \/dev\/disks\/<\/pre>\r\n

\"2016-08-11_17-13-09\"<\/a><\/p>\r\n

As we can see, my identifier is mpx.vmhba40:C0:T0:L0\u00a0<\/strong><\/em>for this device which also matches the identifier from the GUI pics above. \u00a0Note: The other USB (mpx.vmhba32:C0:T0:L0) is a separate USB where ESXi is installed on.<\/p>\r\n

\"2016-08-14_16-48-33\"<\/a><\/p>\r\n

Next, we need to create a GPT (GUID Partition Table) label on the device. \u00a0To do so, run the following command using the correct identifier for the drive. \u00a0In my case, I will run with mpx.vmhba40<\/strong>\u00a0for all of the following commands. \u00a0Be sure to change this to your correct ID.<\/p>\r\n

partedUtil mklabel \/dev\/disks\/mpx.vmhba40\\:C0\\:T0\\:L0 gpt<\/pre>\r\n

\"2016-08-14_17-04-20\"<\/a><\/p>\r\n

Now run the following command to get the partition table information.<\/p>\r\n

partedUtil getptbl \/dev\/disks\/mpx.vmhba40\\:C0\\:T0\\:L0<\/pre>\r\n

\"2016-08-14_17-05-36\"<\/a><\/p>\r\n

This returned the following output for me…<\/p>\r\n

gpt\r\n\r\n973 255 63 15634432<\/pre>\r\n

\"2016-08-14_17-06-01\"<\/a><\/p>\r\n

Next, we need to create a partition in which you will need to know the start sector and end sector which all depend on the size of the device drive and GUID. \u00a0As an FYI…<\/p>\r\n