Comprendre l'inaccessibilité des datastores dans VMware
A datastore, as the name implies, is a repository that stores all the files and data of a VMFS virtual machine. It also stores information about the server components, such like the vSwitches. VMFS datastores are saved as VMDK files on the VMFS partition of a physical hard drive formatted for virtual machine hosting.
But just like every other file type, datastore files can get corrupted or damaged, making them inaccessible for the attached VM. When this happens, all VMs attached to the datastore won’t be able to launch. If you’re facing datastore inaccessibility issues, this article explains the workarounds you can try out.
What is VMware VMFS Datastore?
A VMFS datastore is a logical container running inside the VMware file system (VMFS). It stores the block of a physical storage or LUN to provide a uniform storage model for VM files to be saved. Datastores are stored in VMFS-formatted partitions. If anything should happen to a datastore, all server resources and VMs attached to the virtual storage will fail.
An accessible datastore is very important for the seamless and effective performance of VMs deployed on vSphere ESXi or other VMware virtualization environments. This is because, vSphere ESXi uses datastore to store virtual disks (VMDKs). Of course, datastores can be further edited – renamed or unmounted, at any time.
Why is My VM Inaccessible?
There are many reasons why a virtual machine could be inaccessible; one of these reasons is datastore problems and other can include, server problems, corrupt VM files, corrupt VMDK file, or failed RAID. If your VM storage is still showing online, then the most likely reason why the VM is inaccessible is due to network failure. Of course, your reaction to the situation depends on the actual cause of the issue – VM inaccessibility.
1. Network Failure:
This is one of the commonest causes of VM inaccessibility, but then, it also has the simplest solution. If network connection is the reason you can’t access your VM, then you should check the network cables and storage.
2. Disk Failure:
For VMs connected to a RAID storage, if one drive in the array fails, the VM may not start. In this case, you need to replace the failed drive with a new one and rebuild the array (if it doesn’t support hot-swapping).
3. Corrupt or Damaged Files
Files stored on virtual drives are not immune to data corruption, they can equally get corrupt and inaccessible for the same reasons files on a physical drive would get damaged. That said, one of the reasons a VM could be inaccessible is because the datastore file(s) are corrupted, missing, or damaged.
In this scenario, you need to restore the original datastore file(s) and repair it – using a third-party software. Also, if the VM files are not properly configured, your VM could be pointing to an empty datastore with no host on it, so, you should re-check the VM configuration files.
Steps to Address Inaccessible VM Datastores in VMware Environments:
Generally, if you’re having inaccessible datastores in your VMware virtualized environment, here are some handy tips that could help.
1. Identify the Inaccessible Datastore Locations
First things first, you need to find out where the problematic datastore is stored. To find out datastore details, you can use vSphere Client or PowerCLI.
Using vSphere Client:
- Log in to vSphere Client using your details
- Go to Menu 🡺 Storage 🡺 Datastores and view details of the “inaccessible” datastore.
Using PowerCLI:
- Launch PowerShell as an Administrator and run the following command:
- Get-View -ViewType Datastore -Property Name, Summary |
?{$_.Summary.Accessible -eq $false} | Select-Object name, {N="Type";E={$_.Summary.Type}},
@{N="Capacity";E={ $_.Summary.Capacity} }
2. Troubleshoot the NFS Datastore Issues
If you lost a Network File System (NFS) datastore, or the NFS datastore suddenly becomes inaccessible, shutting down the connected VMs to unmount them from the datastore won’t help, here are some troubleshooting steps that could help.
- Check if you have VM cdrom mounted to ISO files saved on the problematic datastore
- If you do, change the cdrom to host device, and the inaccessible datastore would be gone.
How to Resolve VMFS Datastore Inaccessibility
There are a couple of other ways to resolve VMFS datastore inaccessibility concerns; these are not-so-technical methods, but you still have to follow them carefully.
1. Reload Inaccessible VMs
Virtual machines might be grayed out or marked as “inaccessible” after a permanent device loss (PDL) situation or after you restored a previously failed datastore. To fix this, you have to reload the VMs via CLI using the commands below.
- First, log in to your ESXi host via SSH client and run these commands:
- View all VMs to ascertain which ones need to be reloaded: vim-cmd vmsvc/getallvms
- VMs with the “Skipping Invalid VM” tag are the inaccessible ones that need to be reloaded. Take note of their IDs because that’s what you will use in reloading them.
- Run this code to reload the invalid VMs, one after another: vim-cmd vmsvc/reload 12
- “12” is the ID of the inaccessible VM that needs reloading; replace this number with your actual VM’s ID.
- Run the reload command for each of the invalid VM, when done, use the “getallvms” command to confirm that all your VMs are now accessible and no longer shows “invalid”.
2. Move VMs from Inaccessible Datastores
Another way to resolve VMFS datastore problems is to move all connected VMs to another datastore or host.
- Create a new datastore and clone the virtual machine you want to migrate on vSphere Client – right-click on VM to clone on vSphere Client and select “Clone to Virtual Machine.”
- When the Cloning Wizard prompts, use a unique name for the clone VM and choose a different location in the inventory.
- Leave the rest of the configuration without making any changes and complete the cloning wizard prompts.
- Once complete, right-click the clone VM in the inventory panel and select “Edit Settings.”
- Go to the “Hardware” tab and review the attached virtual disks
- Now, point out the virtual disks to migrate to the new datastore.
- In a bid avoid file conflicts, remove the cloned VM; right-click the cloned VM and select “Remove from Inventory.”
- Enable SSH on the ESXi host where the virtual disks are stored; connect to the host via SSH.
- Go to the VM’s directory on the datastore, the directory should be /vmfs/volumes/datastore_name/vm_name/
- Now, use the vmkfstools command to copy the virtual disks from the current datastore to the new datastore: vmkfstools -i source_disk_path -d thin destination_disk_path
- (repeat this command for each disk to migrate and ensure to replace the “source disk path” and “destination disk path” with the actual directories of the VM data you’re migrating to a new datastore.)
- When the migration is done, you need to register the VM to the new datastore using the vSphere Client. For this, right-click the .vmx file of the original VM (not the clone) and choose “Add to Inventory.”
- Follow the on-screen instructions add the VM back to the inventory.
- Power the VM from the new datastore and verify if the VM is using the disks on the new datastore.
3. Handling Volume Status Changes.
If your VMFS volumes suddenly start showing “offline” status, you can get them back online manually. Usually, this is caused when the volume gets unmounted and made offline; thus, causing the junction path to be removed; so, even if the volume is made online again, the junction path has been removed already and needs to be re-mounted.
The solution is, after bringing the online, you have to manually mount the volume with the same junction path it was connected to.
How to Recover Lost VMFS Volume Data
If you find out your VM files are missing and need to recover them, DiskInternals VMFS Recovery is a professional solution used by many IT specialist for VM data recovery. The software is super intuitive and runs on all Windows OS versions, including Server OS. The DiskInternals VMFS Recovery supports multiple file systems, including EXT, NFTS, and FAT32; you can preview the recovered file too.
Guide:
- Step One: Download and install DiskInternals VMFS Recovery on your PC, launch the app and get started.
- Step Two: Select the hard drive that has the VMFS volume and choose a recovery method; it is advisable to choose Full Recovery.
- Step Three: Wait for the lost files to be recovered, and they will appear with a red asterisk. You can preview the recovered files.
- Step Four: Restore the lost VM files to a new drive. You need to buy a DiskInternals VMFS Recovery Pro license to recover the files.
Conclusion
Datastore inaccessibility can be resolved in many ways, depending on what triggered the situation. Regardless, it is advisable to always back up your VM data to an external storage, and if you experience any data loss, DiskInternals VMFS Recovery can help to get back your files.
FAQ
- Why is my datastore inaccessible?
A primary cause of a datastore becoming inaccessible is a disruption in connectivity, a scenario not unusual for network-attached storage and storage area networks (SANs). This underscores the critical importance of implementing multipathing.
- How do I remove inaccessible NFS datastore?
To accomplish this task, navigate to the desired host in the vSphere Web Client. Then, proceed to the "Configuration" tab and choose either "Storage" or "Datastores." Right-click on the inaccessible datastore, and from the menu that appears, select either "Unmount" or "Detach."
- What is the reason you are unable to expand the datastore?
Reason: vCenter Server invokes a designated function to retrieve all available extents for the specified datastore. Subsequently, vCenter Server identifies these extents as accessible if they satisfy certain filtering criteria: LUNs are not utilized as datastores on the host in question or on any other host (exceptions apply for forcibly mounted volumes).