Let’s look at several ways to access data stored on the datastore with the VMFS file system of the ESXi host (these are configuration files, data files, and snapshots of virtual machines) from Linux, Windows, and VMware hypervisor. Actually, this article is based on a real case of our client when a single VMware ESXi host has suddenly crushed.
If your ESXi host crashes, but the local disks (or LUNs) are still functional, you can copy the virtual machine files and run the VMs on another host (on VMware Workstation or even on Hyper-V). Common operating systems (Windows and Linux) by default won’t see data on a partition with a VMFS file system, because they don’t have a VMFS driver
Let’s consider three scenarios of accessing data on the VMFS datastore.
How to Mount VMFS File System on Linux (Ubuntu)?
Let’s look at how to mount a partition with the VMFS file system on a computer running Ubuntu 20.04 LTS installed. Install the vmfstools package depending on the version of the VMFS file system:
- vmfs-tools – supports VMFS 3 (ESXi 3.x, 4x) andVMFS 5 (ESXi 5.x)
- vmfs6-tools – VMFS 6 (used by default in modern versions of ESXi since vSphere 6.5)
In our example, the disk was connected to an ESXi 7.1 host, so you need to install vmfs6-tools to access data on a VMFS6 file system:
# apt-get -y install vmfs6-tools
Create a mount directory:
# mkdir /mnt/vmfs
Get the disk name and partition type:
# fdisk -l
In our example, you can see that the /dev/sdb drive has an sdb1 partition with the VMware VMFS file system.
Note. To access the GPT partition table on disks larger than 2 TB, use the parted command instead of fdisk:
# parted -l
To mount this VMFS partition on Linux, run the command:
# sudo vmfs6-fuse /dev/sdb1 /mnt/vmfs
The command returned that the specified partition contained a VMFS6 file system and mounted it to the target directory.
Virtual machine files on a VMFS disk are available for you in read-only mode and you can copy them or quickly run them with VMware Player/Workstation.
An error may occur while mounting a partition:
VMFS Unsupported version 5Unable to openfilesystem
In this case, you need to install vmfs-tools which supports VMFS3 and VMFS5:
# apt-get install vmfs-tools
It remains to mount the disk partition with VMFS 5 datastore:
#vmfs-fuse /dev/sdb1 /mnt/vmfs
Mounting VMFS Partition on a New VMware ESXi host
Above, we looked at how to mount VMFS partition using third-party VMFS drivers. However, the most universal way to access data on a VMFS data store 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). I think this is the easiest way to mount a VMFS volume from a physical hard drive or LUN on a storage array device (connected via Fiber Channel or iSCSI).
Follow the steps below to mount an existing VMFS datastore on a new ESXi host without formatting it:
- Connect to the new ESXi server (ESXi 6.7 in this example) using the vSphere Web Client;
- Connect the disk to the new host and perform Storage rescan (if your VMFS is located on an iSCSI LUN, you connect it according to the guide);
- Go to the Devices tab, and find your LUN in the list. Make sure ESXi sees the VMFS partition there;
If the VMFS datastore has been removed from the storage device, check the post “How to recover an accidentally deleted VMFS datastore?”
- Connect to the console of the ESXi host via SSH and run the command:
vmkfstools -V
- This command should find available VMFS partitions on disks and mount them;
- Open vSphere Client and make sure your VMFS storage is now available. Click on it and select Mount;
- Open the Datastore Browser. Now you can access all files on VMFS datastore. You can find the necessary vmx files, register them on the current ESXi host, and immediately run critical virtual machines.
In previous versions of ESXi (6.5, 6.0, 5.x), it was possible to mount an existing VMFS volume from the vSphere Client GUI. To do this, select the Keep the existing signature option when adding a new VMFS datastore.
Accessing VMFS Datastore from Windows
In order to mount the VMFS partition 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 a read-only mode.
You can download Open Source VMFS Driver here: https://code.google.com/archive/p/vmfs/. This project has not been updated since 2010 andthe latest version of the driver that is available on the site is VMFS Driver r95, which supports only VMFS 3 (< VMware ESXi 5.x).
Note. If you try to mount to a newer version of VMFS, you will receive an error message: No VMware File System detected.
- Download Open Source VMFS Driver (fvmfs_r95_dist.zip) and extract it to any directory (e.g., C:\vmfs);
- You can check the operation ofthe java-application fvmfs.jar as follows:
cd \vmfs
java -jar fvmfs.jar - Next, you need to determine the number of the disk containing the VMFS datastore 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 the WebClient service is started. If the service is disabled, run it;
- Mount the shared disk:
net use * http://localhost:50080/vmfs
- A new disk containing read-only VMFS datastore will appear in Windows;
- Do not close the command prompt window while working with files on the VMFS datastore.