Mon–Fri 8:00 a.m.–7:00 p.m., Sat–Sun 9:00 a.m.–5:00 p.m.Drop-off by appointment in Hamilton, Montreal and Vancouver · free pickup across CanadaFrançais

Business

The complete guide to virtual machine data recovery

A virtualization host concentrates a whole company on a few disks: one failure can take down every server at once. The good news is that virtual disks are ordinary files on a file system, and they can be recovered layer by layer, even after a datastore failure or a broken snapshot chain.

Published 5 min readBy Mirush Murataj

Virtualization host and virtual disks. Illustration for the guide “The complete guide to virtual machine data recovery”
Virtualization host and virtual disks

In short

  • A virtual machine is a set of files: virtual disks, snapshots and configuration, stored on a datastore.
  • Failures happen at three levels: the physical storage, the datastore file system, and the virtual disk itself.
  • Snapshots are not backups: a broken chain can make the latest data unreachable.
  • In the lab, the datastore is rebuilt first, then each virtual disk is extracted and opened like a physical disk.

What a virtual machine really is

For the hypervisor, a virtual machine is a set of files. On VMware ESXi, a VMX configuration file, one or more virtual disks (a small VMDK descriptor and a large -flat.vmdk data file), snapshot files (-delta.vmdk or -sesparse.vmdk) and logs. On Hyper-V, an XML or VMCX configuration file, VHDX virtual disks and AVHDX checkpoint files. On Proxmox VE, a configuration file and disks stored as raw or qcow2 files, or as volumes in LVM-thin, ZFS or Ceph.

These files live on a datastore: a VMFS volume on ESXi, an NTFS or ReFS volume (often a Cluster Shared Volume) on Hyper-V, a directory, LVM volume group or ZFS pool on Proxmox. The datastore itself sits on physical storage: local disks behind a RAID controller, a NAS over NFS or iSCSI, or a SAN.

The three layers of failure

The physical storage

Failed disks in the host RAID, a dead controller, a NAS or SAN that no longer presents its volume: every virtual machine stored there disappears at once. The approach is the same as for any server: clone the disks, rebuild the array virtually. See The complete guide to server data recovery and The complete guide to RAID.

The datastore file system

VMFS, NTFS, ReFS or ZFS metadata can be damaged by a power cut, a storage path that drops during writes, or a mistaken format. The datastore then shows as inaccessible, empty or unmounted, while the virtual disk files are still physically present.

The virtual disk

Inside a VMDK or VHDX there is a complete disk, with its own partition table and file system (NTFS, ext4, XFS). It can be damaged like a physical disk: corrupted file system, deleted files, ransomware encryption, a guest operating system that no longer boots.

Snapshots and checkpoints: the trap

A snapshot freezes a virtual disk and sends every new write to a delta file. It is meant to last a few hours, during an update. Left in place for months, the delta grows, performance drops, and the chain becomes fragile. If the delta file is damaged, deleted, or the descriptor no longer points to the right parent, the virtual machine can only start from the old base disk, and months of data seem lost.

In most cases, the delta files are still on the datastore. Their content can be read and merged with the base disk on a copy, in the right order, to bring back the latest state. What must not be done is to delete the "orphan" files, consolidate with errors, or create a new disk over the old ones.

Ransomware and virtualization hosts

Ransomware groups now target hypervisors directly: they encrypt the VMDK files of every virtual machine on an ESXi host, or the VHDX files of a Hyper-V cluster, in one operation. Some variants only encrypt part of each large file to go faster, which sometimes allows part of the virtual disk to be recovered. See Ransomware attack: what to do in the first hours.

What to do when virtual machines are lost

  1. Do not reformat or re-create the datastore, even if the host offers to.
  2. Do not delete files that look orphaned (delta, AVHDX, -ctk.vmdk) and do not consolidate snapshots that report errors.
  3. Stop the virtual machines that still run on the same storage if the datastore shows errors, to limit writes.
  4. Export the host logs (vmkernel.log on ESXi, the Hyper-V event logs) and note the datastore names and sizes.
  5. If the storage is a NAS or a SAN, note its model and the LUN or share used.
  6. Check your backups (Veeam, Nakivo, Proxmox Backup Server) before anything else: the backup repository may be easier to recover than the datastore.

How virtual machines are recovered in the lab

1. Physical storage

The host disks, or the NAS or SAN disks, are cloned. The RAID is rebuilt virtually if needed, to obtain an image of the volume that holds the datastore.

2. Datastore

The VMFS, NTFS, ReFS or ZFS structures are analysed on the image. When the metadata is damaged, the virtual disk files are located by their signatures (VMDK descriptors, VHDX headers, qcow2 headers) and by the allocation maps that remain.

3. Virtual disks and snapshot chains

Each virtual disk is extracted with its snapshots. The chain is rebuilt in the right order and merged on a copy. Thin-provisioned disks, whose blocks are scattered across the datastore, are reassembled using the allocation tables of the file system.

4. Inside the virtual machine

Each virtual disk is then opened like a physical disk: partition table, file system, files. Depending on the case, you receive complete virtual disks ready to be attached to a new host, or the files and databases they contain.

Cost and priorities

A virtualization host often carries several critical servers. We can recover one virtual machine first (the domain controller, the database server) and the others afterwards. Server and virtualization recoveries start at $525 before taxes; the diagnosis is free and the quote is fixed before any work. The Emergency level ($199) gives a diagnosis within 24 to 48 hours, and courier pickup is free anywhere in Canada.

Protecting a virtualized environment

  • Never keep snapshots longer than a few days; they are not backups.
  • Back up at the hypervisor level with a tool that checks its restores, and keep one copy offline or immutable.
  • Separate the backup repository from the production domain and credentials.
  • Monitor the datastore free space: a full VMFS datastore stops every virtual machine that has a snapshot.
  • Document the storage layout: RAID levels, LUNs, datastores, thin or thick disks.

Going further

External references: the VMDK format and the VHD and VHDX formats) on Wikipedia.

Frequently asked questions

Can a deleted or damaged VMFS datastore be recovered?

In most cases, yes. The virtual disk files are located on the image of the volume, by their signatures and the remaining allocation maps, then extracted.

My virtual machine started from an old snapshot: is the recent data lost?

Usually not. The delta files that hold the recent writes are often still on the datastore and can be merged with the base disk on a copy.

Can you recover virtual machines encrypted by ransomware?

Sometimes, partly. Some variants only encrypt part of each large file, and the rest of the virtual disk can be read. Backups and shadow copies are checked too.

Do you need our VMware or Hyper-V licences?

No. The work is done on copies of the disks with our own tools; you receive virtual disks or files that you can use on your own infrastructure.

How much does a virtual machine recovery cost?

Server and virtualization recoveries start at $525 before taxes, depending on the storage and the number of virtual machines. The diagnosis is free and the quote is fixed before any work.

Is your data important?

Do not try anything that could make the fault worse. The diagnosis is free and you get a fixed quote before any work starts.

Request a free diagnosis Virtual machines data recovery

Your device has stopped responding? Switch it off and talk to us.

Calculate cost