Today we’ll discuss three simple ways to access the data stored on VMFS datastore of the ESXi host (these are configuration files, data files and snapshots of virtual machines) from Linux, Windows and ESXi. Actually, this article is based on a real case of our customer when the only productive server with VMware ESXi hypervisor has suddenly stopped working.
If your ESXi host crashes, but the local disk (disks) of the server are still functional, you can always copy the virtual machine files (both data drives and configuration files) from VMFS datastore and run VM on a different server (even on VMware Workstation or Hyper-V). The main problem is that the common operating systems (Windows and Linux) by default do not recognize the partition with the VMFS file system, because they do not have a VMFS driver. In this article we’ll look at how to access virtual machine files on a disk with a VMFS file system.
The issue was that backup of VMware virtual machines hadn’t been configured as well as there was no time to diagnose and solve ESXi host boot problems. Therefore, it was decided to manually copy the files of critical virtual machine from VMFS storage and run it on another host with an urgently installed ESXi.
Let’s examine three scenarios of accessing data on the VMFS datastore.
How to Mount VMFS file system on Linux (Ubuntu)
You can mount a partition with the VMFS file system on a computer with Ubuntu installed (Ubuntu Live CD won’t suit us in this case).
Firstly, you have to connect a physical disk with VMFS file system to the computer (server) with Ubuntu. To access the data on the VMFS volume, you have to install a special third-party vmfs-tools package. This package allows you to access VMFS from non-ESXi hosts. You can access data on this partition in read-only mode. The second important limitation: the developers of vmfs-tools officially announced support for versions of the VMFS file system up to VMFS 5.0. The possibility to connect a partition with VMFS 6 (vSphere 6.0 and 6.5.) is not guaranteed.
Install the package with the following command:
apt-get install vmfs-tools
- http://mirrors.kernel.org/ubuntu/pool/universe/v/vmfs-tools/vmfs-tools_0.2.5-1_amd64.deb – a package for a 32-bit system.
- http://mirrors.kernel.org/ubuntu/pool/universe/v/vmfs-tools/vmfs-tools_0.2.5-1_i386.deb – a package for a 64-bit system.
Download the corresponding package version as follows:
#wget http://mirrors.kernel.org/ubuntu/pool/universe/v/vmfs-tools/vmfs-tools_0.2.5-1_amd64.deb
And install it:
#dpkg -i vmfs-tools_0.2.5-1_amd64.deb
To install package dependencies, use this command:
#apt-get install vmfs-tools
After the package is installed, you need to create a mount point in which the VMFS partition will be mounted:
#mkdir /mnt/vmfs
The next step is to look into the partitions on the disks. creates a number of service partitions when installed in addition to the partition for virtual machine files (VMFS partition).
If the ESXi version is 4 or earlier, or a VMFS storage has been updated from VMFS 3 to VMFS 5, and its size doesn’t exceed 2TB, display the list of disks and partitions like this:
#fdisk -l
As you can see, the VMFS partition is /dev/sdb3 (label VMware VMFS).
So, display the partition information as follows:
#parted -l
Now you only have to mount a partition with the VMFS storage:
#vmfs-fuse /dev/sdb3 /mnt/vmfs
List the contents of the mounted partition:
#ls -all /mnt/vmfs
Now you see all the virtual machine files on the VMFS storage that is available in read-only mode. That means that you can copy the directories and/or individual files of the necessary virtual machines to a separate drive and run them on another ESXi host.
Access VMFS Volume from Windows
To connect the VMFS volume and access virtual machine files from Windows, you’ll need a special Java driver – Open Source VMFS Driver. This driver requires Java version 6 or later and allows to mount VMFS volumes in read-only mode.
You can download Open Source VMFS Driver here: https://code.google.com/archive/p/vmfs/. At the current moment this project has not been updated since 2010 and the latest version of the driver that is available on the site is VMFS Driver r95, which supports only VMFS 3 (< ESXi 5).
-
- Download Open Source VMFS Driver (fvmfs_r95_dist.zip and unpack it to any directory (e.g., C:\vmfs).
- You can check the operation of the java-application fvmfs.jar as follows:
cd \vmfs java -jar fvmfs.jar
- Next, you need to determine the number of the HDDs containing VMFS storage that is connected to your Windows computer. You can find the disk number in the Disk Management Console or using diskpart (in our example, the connected disk has the index 1 – Disk1. For fvmfs driver, this disk has the following name: \\.\PhysicalDrive1).
- Try to get information about this disk:
java -jar fvmfs.jar \\.\PhysicalDrive1 info
- Share this disk with WebDAV:
java -jar fvmfs.jar \\.\PhysicalDrive1 webdav
- Make sure that service WebClient is started. If service disabled, run it.
- Mount the shared disk:
net use * http://localhost:50080/vmfs
- A new disk that contains VMFS datastore available for reading should appear in the system;
- A new disk that contains VMFS datastore available for reading should appear in the system;
- Do not close the console window while working with files on the VMFS storage.
Mounting an existing VMFS Datastore on a new ESXi host
As you can see, in both of the above cases, third-party VMFS drivers for Linux and Windows do not allow working with VMFS 6.0. Therefore, the most universal way to access data on a VMFS partition of a failed server is to connect its disks to a new ESXi server (you can install ESXi on a new host in less than an hour). This is the easiest way. In this way, you can reconnect both the physical hard disk and the LUN from the storage device (via FC or iSCSI).
The new ESXi host must correctly identify the attached VMFS datastore and you will be able to access the files on it.
Follow the steps below to connect an existing VMFS storage to a new ESXi host without formatting it:
- Connect to the new ESXi server using the vSphere Web Client;
- Connect the drive to the new server and run Storage rescan;
- Go to the Configure -> Datastores section and select Create a new datastore item;
- Select the storage type: Disk or LUN;
- In the list of available devices, select the connected drive (LUN) with the VMFS storage;
- Select the connection mode. Select Keep the existing signature item;
- Click the Finish button;
- Go to the host’s storage section. Select the connected storage. Its contents can be displayed by clicking on the Datastore browser button;
- Now you can find the necessary vmx files, register them on host and immediately start the critical virtual machines.
14 comments
Hi.
I cant mount the vmfs drive with net use * http://localhost:50080/vmfs
Get error
System error 67 has occurred.
The network name cannot be found.
I can open the webaddress in IE and see the drive
Running Windows 2012 R2, java 8
Hy! Try to install Desktop Experience feature and check that Web Client service is running.
Is there a way to gain write access to a vmfs version 5 file system from a linux or windows machine?
The most recent version of vmfs tools that I’ve found only provide read access to vmfs version 5 file systems.
vmfs-tools provide read-only access to vmfs datastore
However, you can copy the virtual machine files to a different (working) vmfs datastore
My goal was to gain access to the VMFS to repair some broken things and not just pull data from it. In the end, since my setup is rather small, I just bit the bullet and created new datastores and pulled what I needed from the old ones into the new ones then wiped out the old datastores which eliminated the problem. It seems like something more surgical would have been better but in the end, I needed to get the job done.
Always wonder why these examples are not on a REAL os like Red-hat or Cent. Ubuntu for kids.
Hi, my problem is that I received the exception:
“Exception in thread “main” java.io.IOException: This file has no allocation table (RDM)”
What can I do?
This was an outstanding article that helped me get past a hurdle I was having cloning a bunch of new machines. FYI to others, keep in mind you should “sysprep” your windows OS after you start it up. Thanks for posting this!
I don’t see “keep existing signature” as an option. I am using vmware esxi 6.7 – is this an older version in your screenshots?
This screenshot is from ESXi 6.0. What VMFS mount options are available in your ESXi 6.7?
Mount options aren’t available at all, so there’s 4 options instead of 5. Can only add a new datastore and it doesn’t show this device as available because it’s already formatted. It does show the drive under Storage Devices. And I’ve successfully found the partition with a windows tool.
PHIL, did you ever figure out a solution? I am running into the same issue, trying to use 6.7 and mount old VMFS
One option is to use qemu-img to convert to a raw or a qcow2 partition. Obviously this is painful if you need to boot up in VMware again but if you just need to grab files it is probably easiest to just convert to raw.
I got a need to restore data from failed RAID10. ESXi 6.5 was able to boot, but completely hangs on trying to do something like “ls /vmfs/volumes/”.
This article was a great start for data recovering operation! Everything worked fine. As I had to work with VMFS6 – there is another tool available: vmfs6-tools. The rest – worked in the same way.