VMFS Recovery™
Recover data from damaged or formatted VMFS disks or VMDK files
Recover data from damaged or formatted VMFS disks or VMDK files
Last updated: Jul 14, 2026

XCP-ng VHD Recovery: Recover VM Data from Corrupted VHD Files

Virtualization platforms like XCP‑ng deliver flexibility and performance, but when a VHD file becomes corrupted or a Storage Repository (SR) fails, the impact can be immediate — virtual machines stop, workloads crash, and critical data becomes inaccessible.

This guide explores practical methods for XCP‑ng VHD recovery, covering how to:

  • Repair damaged or broken VHD chains.
  • Recover files from inaccessible SRs (EXT4, LVM, and more).
  • Handle corruption caused by failed snapshots, interrupted migrations, or disk errors.
  • Use built‑in tools and professional recovery software to restore VM data safely.

By the end, you’ll have a clear framework for bringing XCP‑ng virtual machines back online, minimizing downtime, and protecting your infrastructure against future storage failures.

Would you like me to expand this intro into a problem/solution flow (failure scenarios → recovery workflows → prevention tips) so the article builds naturally into technical detail?

XCP‑ng Recover VM: Fast Recovery Decision Matrix

When a virtual machine fails in XCP‑ng, the right recovery path depends on where the failure occurred — backup availability, metadata integrity, SR accessibility, or VHD corruption. Use the following decision matrix to quickly choose the safest option:

Recovery OptionBest Use CaseRead/Write BehaviorComplexityData Safety
Restore from BackupVM has recent backup or snapshot availableRead‑only restore from backup mediaLowHighest — guaranteed safe if backup is intact
Restore MetadataVM configuration lost but disks intactMinimal writes to config onlyLow to moderateSafe if SR and VHDs are healthy
Reconnect SRSR disconnected or inaccessible but disks are fineRead‑only scan and reattachModerateSafe, provided SR metadata is consistent
Recover VHD FilesCorrupted or missing VHD chains, broken snapshotsRead‑only scan with virtual reconstructionModerate to highSafe if handled without forced rebuilds
Storage‑Level RecoverySevere corruption, damaged SR metadata, or multiple disk issuesRequires imaging and deep scanHighRiskier — best combined with professional tools

👉 Rule of thumb:

  • Always start with backups if available.
  • Move to metadata restore or SR reconnect if the issue is logical.
  • Escalate to VHD recovery or storage‑level workflows only when higher layers fail.

This structured approach minimizes downtime and reduces the risk of permanent data loss in XCP‑ng environments.

XCP‑ng Disk Repair: What to Do Before You Touch the Storage

When corruption strikes in XCP‑ng, the first rule is to protect the data state. Any rushed or unsafe action can make recovery impossible. Treat the disks as fragile evidence — every write risks overwriting recoverable sectors. Follow these emergency rules before attempting repair:

  • Stop all VM writes — Shut down or suspend every VM running on the affected SR.
  • Do not create new VMs — New allocations will overwrite sectors that may still contain recoverable data.
  • Do not initialize disks — Initialization erases metadata and destroys the original structure.
  • Do not rebuild RAID without imaging — Always create byte‑level clones before attempting any RAID rebuild.
  • Do not mount damaged storage read‑write — Mounting in write mode can corrupt file system structures beyond repair.
  • Work only from clones — Use forensic images or disk copies for all recovery attempts, keeping the originals untouched.

⚠️ These rules are non‑negotiable. They ensure that recovery efforts — whether metadata repair, VHD reconstruction, or SR reattachment — are performed on safe duplicates, not the original disks. This preserves the maximum chance of restoring your XCP‑ng environment.

XCP‑ng VDI Recovery: How Virtual Disks, VHD Files, and Metadata Connect

To understand recovery in XCP‑ng, it’s essential to know how the core storage objects relate to each other:

  • VDI (Virtual Disk Image) → This is the logical disk object inside XCP‑ng. Each VM is linked to one or more VDIs, which represent its virtual hard drives.
  • VHD (Virtual Hard Disk) → On file‑based SRs (like EXT4), the VDI is stored as a VHD file. These files can form snapshot chains, and corruption often occurs when merges or exports fail.
  • SR (Storage Repository) → The SR is the container that holds all VDIs and their associated VHD files. It can be file‑based (EXT4) or block‑based (LVM).
  • Pool Metadata → This maps the relationships between VMs, VDIs, SRs, networks, and hosts. If metadata is lost or corrupted, the VM may appear missing even though its VHDs still exist.

👉 In recovery workflows, you may need to rebuild metadata, reconnect SRs, or extract VHDs directly. Understanding how these objects connect ensures you target the right layer — whether fixing VM configuration, repairing SR metadata, or reconstructing VHD chains.

XCP‑ng Restore Deleted VM: Backup, Metadata, and VHD Paths

When a VM is deleted in XCP‑ng, recovery depends on whether backups exist, metadata is intact, or only raw disk files remain. Here are the three main paths:

Restore from Xen Orchestra Backup

If you use Xen Orchestra (XO), the simplest option is a full VM restore:

  • Reconnect the backup repository to your XCP‑ng pool.
  • Select the deleted VM from the backup list.
  • Restore directly to the same host or deploy to a fresh XCP‑ng environment. This method ensures the VM configuration, disks, and snapshots are rebuilt exactly as they were at backup time.

Restore VM Metadata When Storage Still Exists

If the VM was deleted but the Storage Repository (SR) still contains its disks:

  • Use pool metadata restore tools to rebuild the VM configuration.
  • Re‑import the SR into the pool if the host was lost.
  • Link existing VDIs back to a new VM shell. This path works when the VM definition is gone but the actual disk data remains intact.

Recover VHD or VDI Data When No Backup Works

If no backup is available and metadata cannot be restored:

  • Scan the SR or physical disks for VHD/VDI files.
  • Extract virtual disk data using recovery software.
  • Validate guest files (documents, databases, OS partitions) to confirm integrity.
  • Rebuild a new VM shell in XCP‑ng and attach the recovered disks. This is the most manual path, but it ensures you can still recover critical data even when higher‑level recovery options fail.

👉 The choice depends on what survived: backups → metadata → raw disks. Always start with the safest option before escalating to deeper recovery.

XCP‑ng Storage Recovery: Local SR, NFS, iSCSI, and RAID Cases

Storage recovery in XCP‑ng depends heavily on the backend type. Each storage repository (SR) has unique risks and workflows.

Local SR Recovery

Local SRs typically use LVM over physical disks.

  • Failures often involve disk corruption or damaged LVM metadata.
  • Overwritten blocks from failed snapshots or VM writes can complicate recovery.
  • Best practice: clone the disk first, then attempt metadata repair or VHD extraction.

NFS SR Recovery

NFS‑based SRs store VHD files directly on a NAS.

  • Common issues: deleted VHDs, broken snapshot chains, or accidental formatting.
  • Recovery paths include NAS snapshots, recycle bins, or filesystem‑level undelete tools.
  • Always mount NFS shares read‑only before scanning for lost files.

iSCSI or Fibre Channel SR Recovery

Block‑based SRs on SANs (iSCSI/FC) present different challenges.

  • Use LUN cloning to create safe images before scanning.
  • Perform read‑only scans to avoid overwriting metadata.
  • If the storage array supports snapshots, leverage them for rollback and recovery.

RAID‑Backed SR Recovery

RAID arrays add complexity when disks fail.

  • Risks include failed members, bad rebuild attempts, controller loss, or parity corruption.
  • Always perform sector‑level imaging of each disk before reconstruction.
  • Rebuild arrays only after imaging and verifying disk order.
  • If parity damage is severe, escalate to professional recovery services.

👉 Each backend requires a tailored approach: local SRs demand careful LVM handling, NFS relies on file recovery, SANs depend on LUN imaging, and RAID needs forensic reconstruction.

SR typeMain failureRecovery focus
Local SRDisk, LVM, host failureClone disk and recover VDI data
NFS SRDeleted or corrupted VHDNAS snapshot or file recovery
iSCSI SRLUN corruptionClone LUN and scan read‑only
RAID SRDisk/controller failureRebuild RAID image before VM recovery

✅ Quick takeaway:

  • Local SR → focus on cloning the disk and extracting VDI data.
  • NFS SR → leverage NAS snapshots or file‑level recovery.
  • iSCSI SR → clone the LUN and perform read‑only scans.
  • RAID SR → rebuild the RAID image first, then proceed with VM recovery.

XCP‑ng SR Recovery: Reconnect, Introduce, or Recover the Storage Repository

In XCP‑ng, not every “SR recovery” means repairing corrupted data. Often, it’s an administrative reconnection — re‑establishing links between the pool and the storage repository — rather than a full forensic recovery. Knowing the difference helps avoid risky commands that could overwrite metadata.

Administrative Reconnection Concepts

  • SR Probe → Detects available storage backends and confirms connectivity.
  • SR Introduce → Re‑registers an existing SR into the pool when metadata is intact but the SR is missing from configuration.
  • PBD Creation (Physical Block Device) → Defines the link between a host and the SR.
  • PBD Plug → Activates the connection so the SR becomes usable again.
  • Metadata Restore → Rebuilds VM and SR mappings when configuration is lost but disks are still healthy.

When It’s Real Data Recovery

If the SR itself is corrupted — damaged metadata, missing partitions, or broken VHD chains — administrative steps won’t be enough. In those cases, recovery means scanning disks, reconstructing VHDs, or repairing SR metadata at the storage level.

👉 The key distinction: administrative reconnection restores visibility, while data recovery restores content. Always start with safe reconnection attempts before escalating to deeper recovery workflows.

XCP‑ng Corrupted VHD: Signs, Causes, and Recovery Options

When a VHD file becomes corrupted in XCP‑ng, the VM may fail to boot or lose access to its virtual disks. Recognizing the symptoms early helps prevent further damage:

  • VM will not boot or hangs during startup
  • Missing disk entries in Xen Orchestra or xe CLI
  • Failed snapshot creation or merge operations
  • Guest partitions unreadable or reporting filesystem errors
  • I/O errors in logs or during VM operations
  • Damaged VHD chain with broken parent/child links
  • Failed export or import of VM images

Common Causes of Corrupted VHD Files

  • Power loss during active write operations
  • Host crash or abrupt shutdown of XCP‑ng
  • Storage disconnects on NFS or iSCSI backends
  • Bad sectors on physical disks
  • Failed snapshot merge leaving orphaned differencing disks
  • NAS failure or network interruption during VHD access
  • RAID degradation or controller malfunction corrupting parity and metadata

Safe Recovery Workflow for Corrupted VHD

To maximize recovery chances, follow a controlled workflow:

  1. 1. Clone the source disks → Create byte‑level images of affected drives before attempting repair.
  2. 2. Scan the VHD files → Use recovery software to detect partitions and validate VHD chain integrity.
  3. 3. Mount read‑only → Never mount damaged VHDs in write mode; use read‑only access for inspection.
  4. 4. Inspect partitions → Check guest OS partitions for consistency and identify recoverable data.
  5. 5. Export files → Copy validated documents, databases, and system files to safe storage.
  6. 6. Rebuild the VM shell → Create a new VM in XCP‑ng and attach recovered VDI/VHD files.

👉 This workflow ensures that recovery is performed safely, without overwriting critical structures, and provides a clear path from detection to restoration.

XCP‑ng Recover Snapshots: Snapshot Chains, Broken Links, and Data Risk

Snapshots in XCP‑ng are convenient for short‑term rollback, but they are not backups. When snapshot chains break, the risks escalate quickly:

  • A broken chain can block VM boot, leaving the system unstartable.
  • Corruption may hide the latest VM state, making recent data inaccessible.
  • Failed merges can damage parent VHDs, spreading corruption across the chain.
  • Inconsistent links may cause guest partitions to appear unreadable or missing.

⚠️ Critical rule: Always preserve every related VHD/VDI file before attempting repair. Copy or image the entire snapshot chain to safe storage. Recovery efforts should only be performed on clones, never on the original disks.

👉 Treat snapshots as temporary rollback points, not long‑term protection. For reliable recovery, combine snapshots with regular backups and metadata exports to ensure VM data can be restored even if snapshot chains fail.

Virtual Machine File Recovery: Where DiskInternals VMFS Recovery™ Fits

DiskInternals VMFS Recovery™ is purpose‑built for VMware environments, designed to handle VMFS datastores and VMDK virtual disks. It provides a strong example of specialized virtual machine file recovery with features such as:

  • Read‑only scanning to protect original data integrity.
  • Preview before export, allowing verification of recoverable files.
  • RAID support, reconstructing arrays before scanning VMFS volumes.
  • Remote recovery over SSH without shutting down hosts.
  • Virtual disk handling, including snapshots, templates, and large VMDK files.

While VMFS Recovery™ is specific to VMware, the recovery logic applies directly to XCP‑ng:

  1. 1. Protect the source — never write to damaged disks; work from clones.
  2. 2. Recover the virtual disk — scan VHD/VDI files or SRs for usable data.
  3. 3. Validate guest data — confirm partitions, files, and databases are intact.
  4. 4. Rebuild the VM shell — create a new VM in XCP‑ng and attach recovered disks.

👉 The takeaway: VMFS Recovery™ illustrates how specialized tools approach virtual machine file recovery. In XCP‑ng, the same disciplined workflow — protect, recover, validate, rebuild — ensures safe restoration of VMs after corruption or deletion.

Backup Restore vs VHD Recovery vs SR Recovery

Different recovery methods in XCP‑ng apply to different failure scenarios. The table below summarizes when to use each approach and its main limitation:

MethodUse WhenMain Limit
Xen Orchestra restoreBackup existsDepends on backup integrity
Metadata restoreHost lost, SR intactDoes not recover deleted data
SR reconnectionStorage exists but detachedRequires intact SR metadata
VHD recoveryVHD deleted or corruptedOverwrite risk if not cloned first
RAID recoveryStorage array failedRequires disk‑level imaging

👉 Always start with the least invasive method (backup or metadata restore) before escalating to deeper recovery like VHD or RAID reconstruction.

⚠️ Common Mistakes That Destroy XCP‑ng Recovery Chances

🛑 Creating New VMs on the Same SR

Launching new VMs on the affected SR overwrites disk sectors that may still contain recoverable data. Once overwritten, those blocks are gone forever, eliminating the chance of restoring deleted or corrupted VHDs.

🛠️ Running Repair Commands Before Imaging

Commands like xe sr-repair or filesystem fixes can alter or destroy metadata structures. Without a forensic image, you only get one shot — and a failed repair can make recovery impossible. Always clone the disks first to preserve the original state.

🔄 Reinitializing the SR During Host Reinstall

Reinitialization wipes SR headers and metadata, erasing the logical map between VDIs and VHD files. Even if raw data remains, recovery becomes far more complex because the structure is lost. Avoid reinitializing; instead, use SR introduce or metadata restore.

💾 Mounting Damaged Storage Read‑Write

Mounting a corrupted SR in write mode risks overwriting partition tables, snapshot chains, and filesystem metadata. Always mount read‑only and work from clones to prevent irreversible corruption.

📉 Assuming Metadata Restore Recovers Deleted Disk Data

Metadata restore only rebuilds VM definitions and SR mappings. It does not resurrect deleted VHD files. If the disk data is gone, metadata alone cannot bring it back — you’ll need VHD recovery or storage‑level scanning.

👉 The golden rule: Preserve first, recover second. Acting too quickly with destructive commands or writes is the fastest way to lose data permanently.

📝 Final XCP‑ng Recovery Checklist

A safe recovery sequence keeps your data intact and avoids destructive mistakes. Follow these steps in order:

🛑 Stop Writes

Immediately halt all VM activity on the affected SR. Suspend or shut down workloads to prevent further disk changes.

🔍 Identify SR, VDI, VHD, Host, and Pool Metadata

Map out the recovery objects: which SR is impacted, which VDIs belong to the VM, where the VHD files reside, and whether pool metadata is intact.

📂 Check XO Backups and Metadata Backups

Verify if Xen Orchestra backups or exported metadata exist. These are the safest recovery paths and should be attempted first.

💾 Clone Affected Storage

Create byte‑level images of the disks or LUNs. Work only from clones to preserve the original state for multiple recovery attempts.

📀 Recover VHD, VDI, or Guest Files

Scan the cloned storage for VHD/VDI files. Extract partitions and guest files using read‑only recovery tools.

🔒 Validate Data Read‑Only

Mount recovered disks or partitions in read‑only mode. Confirm file integrity, check databases, and ensure OS partitions are consistent.

🧹 Restore to Clean Storage

Copy validated data to a fresh SR or storage backend. Avoid writing back to the damaged SR to prevent re‑corruption.

🖥️ Rebuild the VM and Test Boot

Create a new VM shell in XCP‑ng. Attach recovered VDIs or VHDs, then test boot carefully. Validate guest OS functionality before returning the VM to production.

FAQ

Related articles

FREE DOWNLOADVer 4.28, WinBUY NOWFrom $699

Please rate this article.