It is not uncommon, especially in troubleshooting scenarios where you might find yourself needing to transfer files to or from an ESXi host using a USB device as it may not be reachable on the network. Another common case for directly attaching a USB device to an ESXi host is to transfer a large amount of Virtual Machines that were exported from another system and rather than streaming the content from your desktop, you may want to connect it directly to ESXi host. In fact, I had this very use case when I was a customer after we had acquired a company and needed to transfer their assets to our infrastructure. The IT admins just copied everything onto a USB device and then shipped us the drive for processing.
Historically, it was understood that ESXi could only access a USB device (requires disabling the USB arbitrator service) if it contains a FAT16 partition which are then automatically mounted under the /vmfs/volumes/ path. The biggest issue with FAT16 is that the size of the partition has to be <=2GB which severely limits its use for larger files. Another alternative that came up in recent years years is that you could run VMFS on a USB device, but that obviously would require you to format the USB device with VMFS and it would only be readable between ESXi hosts. If you were looking for something more generic like FAT32 which supports a larger partition size, it was assumed this was not possible, at least I was under that impression.
It was only recently as part of a project I had been working on where I was re-visiting this topic that I had discovered that other partition types such as FAT32 and even NTFS from a USB device could actually be accessed by ESXi 6.x. The assumption that I and probably others had made was that just because the partitions were not visible or mounted by ESXi, it does not mean the underlying USB device would also not be accessible. To access a FAT32 partition from a USB device in ESXi, you can use the mcopy utility from the ESXi Shell and for accessing an NTFS partition from a USB device in ESXi, you can use ntfscat utility. It actually took me some trial/error to get the correct syntax, but you can see how to use the utilities below.
Note: You still need to disable the USB arbitrator service for ESXi to see the USB device before you can read from it.
FAT32
Copy a file from USB device to ESXi host:
/bin/mcopy -i "/dev/disks/${USB_KEY}:2" ::/MyFile /tmp/MyFile
Copy a file from ESXi host to USB device:
/bin/mcopy -i "/dev/disks/${USB_KEY}:2" /tmp/MyFile ::/MyFile
NTFS
Copy a file from USB device to ESXi host:
/bin/ntfscat -f /dev/disks/${USB_KEY}:2 MyFile > /tmp/MyFile
One limitation to be aware of when using FAT32 on a USB device is that the maximum file size is <=4GB. If you need to transfer larger files from the USB device, you would need to chunk it up and re-construct the file on the ESXi host. One neat trick that I learned from my buddy Timo Sugliani is that you could use the split command which can be found on a Mac OS X or Linux system to break up the original file into smaller chunks. You can then re-construct the original file by simply using the cat command which is available in the ESXi Shell.
Here is the syntax for splitting a file into 1GB chunks:
split -b 1073741824 [FILE-TO-BE-SPLIT]
Here is the syntax for rebuilding the individual chunks into the original file:
cat [SPLITTED-FILES]* > [ORIGINAL-FILE-NAME]
Hopefully these scenarios is not something you would need to frequently do in your environment, but in case you do, there are some additional options beyond FAT16 🙂
Maren says
Thank you so much for this article! But I've still got one question: What's the ":2" at the end of the source path for? Because in my case, I got an error message that the device /dev/disks/mpx.vmhba38:C0:T0:L0:2 does not exist (but with :1 instead of :2 it seems to work). Thanks in advance!
Chris Stone says
The ":2" is the partition number and will depend on how you laid out the partitions on the USB stick. I believe he was experimenting with his kickstart autodeploy process, where he uses 3 partitions on a USB stick.
Chris Rayne says
Hi, thanks for the article, but I can't seem to make this work. All I get is the following error:
# ntfscat -v /dev/disks/mpx.vmhba35\:C0\:T0\:L0:1 source > destination
Failed to determine whether /dev/disks/mpx.vmhba35:C0:T0:L0:1 is mounted: No such file or directory.
Use the force option to ignore this error.
ERROR: couldn't mount volume: No such file or directory.
Any ideas, please?
Thank you.
nereknu says
Hi, I'm trying ntfscat right now. I'm getting quite similar message "Failed to determine whether mpx.vmhba38:C0:T0:L0:1 is mounted: No such file or directory." but it is followed by more optimistic line "Forced to continue."
If you execute ntfscat withou switches then you will get help and there is mention "-f" switch. Maybe that's it.
Ben Chan says
Hello.
I am wondering if someone can tell me how to determine ${USB_KEY} please.
Thank you for your help.
Cody Wray says
Some answers here that I stumbled upon that might help someone. To find the USB drive location look in the disks directory:
cd /dev/disks/
ls -lh
Find your disk, usually easiest to spot it by size (hence the "h" in the command below for human readable size). Then your disk location will be:
/dev/disks/xxx.XXXXXXXXXXXXX:Y
Yours will look different but just sub in the disk name you found. The :Y will represent the partition number you want. My final command ended up looking like:
/bin/ntfscat -f /dev/disks/naa.5000000000000001:2 /MyFiles/FileIwantToCopy1.vmdk > /vmfs/volumes/StoreA/VirtualMachineA/FileIwantToCopy1.vmdk
Mark Simmons says
Thanks so much. This is the answer that worked for me on ESXi 6.7u3 with an external NTFS formatted disk containing a 250Gb vmdk (Veeam BackupCopy from another server). It would have taken too long to use scp in this network.
motoko says
How can I copy a folder instead a single file ?
huanguo says
How to copy the file from ESXi host to USB with NTFS format?
huanguo says
/bin/ntfscat -f /vmfs/volumes/datastore1\ \(4\)/1.txt > /dev/disks
/naa.2020030102060804:1 1.txt
-sh: can't create /dev/disks/naa.2020030102060804:1: Function not implemented
It doesn't support, right?
avs262 says
Instead of splitting the files you can use 'fat32 LBA' partition type, to support files up to 4GB. It'll still be a bootable partition for ESXI.
MOHAMED says
Hi William,
Thanks for your tutorial.
I followed the steps. However, I'm getting the following error:
"Failed to determine whether mpx.vmhba44:C0:T0:L0:1 is mounted: No such file or directory.
Forced to continue.
Cannot find attribute type 0x80."
I've tried to read my external hard drive (USB: NTFS) from the ESXi 6.0 host.
Can you help me please ?
Thanks
Namenloser Leser says
I ended up accessing the vmfs via scp, that was much simpler than any other option I had.
killua dk says
Hi
am Running VMware ESXi 7.0.0 build-16324942
ntfscat is not found in version 7 do you have another solution to copy from NTFS usb to ESXI
scp work for me but only for small files am trying to copy vmdk 30G and my network isn't that good {wifi }