How to access VMFS Datastore from Linux, Windows and ESXi

本文介绍如何从Linux、Windows和新ESXi主机访问VMFS数据存储中的虚拟机文件,包括配置文件、数据文件和快照。通过使用第三方驱动程序如vmfs-tools和OpenSourceVMFSDriver,即使在ESXi主机崩溃的情况下,也能确保数据的可访问性和虚拟机的连续运行。

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.

 

Contents:

 

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:

1
apt-get install vmfs-tools

NoteIn Ubuntu repository, only vmfs-tools 0.2.1 is available, and its main drawback is that it can work only with VMFS v3. If you need to mount a VMFS 5 datastore, you will have to download and install vmfs-tools 0.2.5 or higher, for instance, here:

 

  1. 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.
  2. 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:

1
#wget http://mirrors.kernel.org/ubuntu/pool/universe/v/vmfs-tools/vmfs-tools_0.2.5-1_amd64.deb

And install it:

 

1
#dpkg -i vmfs-tools_0.2.5-1_amd64.deb

 

To install package dependencies, use this command:

1
#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:

1
#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:

 

1
#fdisk -l

fdisk show esxi partitions in ubuntu

As you can see, the VMFS partition is /dev/sdb3 (label VMware VMFS).

ImportantIn ESXi 5 and later, VMFS v5 is used with the GPT partition table. GUID Partition Table allows to create larger storages (larger than 2TB), as well as connect RDM-drives in the physical compatibility mode. So to view the partition table you have to use the command parted instead of fdisk.

 

So, display the partition information as follows:

1
#parted -l

 

Now you only have to mount a partition with the VMFS storage:

 

1
#vmfs-fuse /dev/sdb3 /mnt/vmfs

List the contents of the mounted partition:

1
#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).

Note. If you try to connect 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 unpack it to any directory (e.g., C:\vmfs).
    • You can check the operation of the java-application fvmfs.jar as follows:
      1
      2
      
      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:
      1
      
      java -jar fvmfs.jar  \\.\PhysicalDrive1 info

      java -jar fvmfs.jar \\.\PhysicalDrive1 info

    • Share this disk with WebDAV:
      1
      
      java -jar fvmfs.jar \\.\PhysicalDrive1 webdav
    • Make sure that service WebClient is started. If service disabled, run it.start webdav service
    • Mount the shared disk:
      1
      
      net use * http://localhost:50080/vmfs
    • A new disk that contains VMFS datastore available for reading should appear in the system; vmware esxi vmfs partition show in windows
    • 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:

  1. Connect to the new ESXi server using the vSphere Web Client;
  2. Connect the drive to the new server and run Storage rescan;
  3. Go to the Configure -> Datastores section and select Create a new datastore item;esxi add an existing vmfs datastore to a new host
  4. Select the storage type: Disk or LUN;
  5. In the list of available devices, select the connected drive (LUN) with the VMFS storage;
  6. Select the connection mode. Select Keep the existing signature item;connect vmfs Keep the existing signature
  7. Click the Finish button;
  8. Go to the host’s storage section. Select the connected storage. Its contents can be displayed by clicking on the Datastore browser button;vmfs datastore browser
  9. Now you can find the necessary vmx files, register them on host and immediately start the critical virtual machines.
<think>好的,我现在需要解决用户提出的ESXi无法识别Datastore的问题。首先,我得仔细分析用户的问题描述和相关引用内容,确保自己理解清楚。 根据用户提供的引用内容,特别是引用[3],问题描述是客户新建了一个ESXi集群,存储映射后有三个LUN显示为“未消耗”,而旧集群正常。解决方法是使用esxcfg-volume命令重新挂载VMFS卷。这说明可能Datastore已经存在VMFS签名,但未被正确识别或挂载。 接下来,我需要整理解决问题的步骤。首先,确认存储连接是否正常,包括物理连接和配置。然后检查LUN是否被正确识别,比如在存储设备中查看是否存在这些LUN。如果存储设备中能看到LUN但Datastore未显示,可能需要手动挂载。 引用[3]中的解决步骤提到使用esxcfg-volume命令,这应该是一个关键点。具体来说,使用esxcfg-volume -l列出有VMFS签名的LUN,然后用-M参数重新挂载。同时,用户可能需要执行存储重新扫描(Storage Rescan),如引用[4]所述,以确保ESXi主机能识别到新的存储设备。 另外,引用[2]提到Datastore的映射关系,需要确认存储的LUN是否正确映射到ESXi主机,并且ZONE划分没有问题。如果ZONE配置错误,主机可能无法访问这些LUN,导致Datastore无法识别。 还要考虑VMFS签名冲突的可能性。如果Datastore已经被其他主机挂载,或者在挂载时出现签名冲突,可能需要解决冲突后才能挂载。此外,检查VMFS版本兼容性也很重要,确保ESXi版本支持现有的VMFS版本。 最后,如果所有方法都无效,可能需要重新初始化LUN,但这会导致数据丢失,所以必须谨慎操作,并确保有备份。用户需要根据具体情况选择合适的方法,优先尝试非破坏性的解决步骤,如重新挂载和重新扫描。 总结步骤时,应该按照从基础检查到高级命令的顺序,帮助用户逐步排查问题,确保每一步都清晰可行。同时,引用相关的参考资料来支持解决方案的可靠性,比如引用[3]和[4]中的具体命令和操作流程。</think>### ESXi无法识别Datastore的解决方案 当ESXi无法识别Datastore时,可能由存储映射异常、VMFS签名冲突或配置错误导致。以下是逐步排查和解决方法: #### 1. **确认存储连接状态** - **物理检查**:确保存储设备与ESXi主机的物理连接(如光纤通道、iSCSI)正常,无松动或断开。 - **存储设备可见性**:在ESXi的`存储设备`界面(`Host > Configure > Storage Devices`)中,检查目标LUN是否显示为“活动”状态[^3][^4]。 #### 2. **重新扫描存储设备** - 在vCenter或ESXi主机界面执行`Storage Rescan`操作,强制刷新存储设备列表: - **操作路径**:`Host > Configure > Storage > Rescan Storage`。 #### 3. **检查LUN映射与ZONE配置** - 确保存储的LUN已正确映射到ESXi主机,且SAN交换机中的ZONE划分未错误。 - 使用命令检查已识别的LUN: ```bash ls -l /dev/disk/naa.* ``` #### 4. **手动挂载VMFS卷** - 如果LUN已存在VMFS签名但未挂载,通过以下命令重新挂载: ```bash esxcfg-volume -l # 列出带有VMFS签名的LUN esxcfg-volume -M <VMFS_UUID> # 持久挂载指定卷[^3] ``` #### 5. **处理VMFS签名冲突** - 若多个LUN的VMFS签名冲突(例如克隆存储导致),需卸载冲突卷或重新初始化其中一个LUN(注意:初始化会删除数据)。 #### 6. **重建Datastore(谨慎操作)** - 如果Datastore损坏且无法修复,可尝试重新创建: 1. 卸载现有Datastore:`esxcli storage filesystem unmount -p <Datastore路径>`。 2. 格式化并新建VMFS分区:通过`Host > Configure > Storage > New Datastore`操作。 #### 7. **验证存储兼容性** - 确认ESXi版本支持当前VMFS版本(如VMFS6适用于ESXi 6.5及以上)。 --- ###
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值