Created
February 20, 2025 01:49
-
-
Save x011/09eed44b731d3a1dbca481a4c6c7ff1c to your computer and use it in GitHub Desktop.
Revisions
-
x011 created this gist
Feb 20, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,121 @@ # ๐ ๏ธ How to Recover VMware Virtual Machine Files When the Parent Disk is Deleted, Removed, or Corrupted ๐พ ## ๐จ Error Message Example: > **File not found:** `449_win-000004.vmdk` > > This file is required to power on this virtual machine. If this file was moved, specify the new location.  If you've **just moved** the file, the solution is simple: browse and select the missing file. However, if the file was **deleted or corrupted**, you'll need to follow a few extra steps to recover your data. --- ## ๐ ๏ธ Tools Youโll Need: ๐น **QEMU Windows Binaries** โ [Get them here](https://qemu.weilnetz.de/) ๐น **TestDisk** โ [Download here](https://www.cgsecurity.org/wiki/TestDisk_Download) --- ## ๐ Step 1: Navigate to Your Virtual Machine Directory Locate the folder where your **VMware virtual machine files** are stored. --- ## ๐ Step 2: Create and Edit a New VMDK File 1๏ธโฃ **Make a Copy** - Find the first `.vmdk` file (e.g., `449_win-cl1.vmdk`). - This file should be **very small (2โ3 KB)**. - Copy it and rename it to **`fixed.vmdk`**. 2๏ธโฃ **Edit the File** - Open **`fixed.vmdk`** using a text editor. - **Find and remove the following line:** ```plaintext parentFileNameHint="F:\vms\449_win\449_win-000004.vmdk" ``` ๐ *Note:* The path above is **just an example**โyour path will be different! - **Change `parentCID` to mark the disk as standalone:** ```plaintext parentCID=ffffffff ``` - **If `ddb.adapterType` is missing, add:** ```plaintext ddb.adapterType = "lsilogic" ``` - **Save** the file. --- ## ๐ Step 3: Convert the VMDK to a Raw Image ๐ **Important:** Open **Command Prompt (cmd) in the same directory** where `fixed.vmdk` is located. Then, run the following command: ```sh "c:/full/path/to/qemu-img.exe" convert -f vmdk -O raw "fixed.vmdk" "fixed.img" ``` ๐ **This process may take a few minutes** depending on the file size and disk speed. --- ## ๐ ๏ธ Step 4: Extract Files Using TestDisk ๐ **Important:** You **must** open a **Command Prompt as Administrator** (**elevated cmd prompt**), and navigate to the same directory where `fixed.img` is located. Then, run the following command: ```sh "c:/full/path/to/testdisk_win.exe" fixed.img ``` Follow these steps: - **Select:** `Proceed` โก๏ธ Press `Enter` - **Choose Partition Type:** `[Intel] Intel/PC partition` โก๏ธ Press `Enter` - **Select:** `[Analyse]` to check for lost partitions โก๏ธ Press `Enter` - **Choose:** `[Quick Search]` โก๏ธ Press `Enter` โ **If all goes well, you should see a list of partitions:**  --- ## ๐ Step 5: Recover Your Files 1๏ธโฃ **Create the Recovery Destination** - Open **Windows Explorer**, and create a new folder where you want to save the recovered files. ๐ *For convenience, it should be in the same directory where `fixed.img` is located.* 2๏ธโฃ **Select the Partition Containing Your Data** - Example: ```plaintext P HPFS - NTFS 82 57 40 7832 95 7 124506112 ``` - Press **`P`** to list files:  3๏ธโฃ **Browse and Select Files** - **Navigate to the folder you wish to recover** using the **arrow keys**. - Press **`c`** to copy all files within that directory. - TestDisk will ask you to **choose a folder to save the files**. - Select the folder you created earlier and **press `c` again** to start the recovery. ๐ If all goes well, you should see **0 failed** and a confirmation of the recovered files!  --- ## โ Thatโs It! Youโve successfully recovered your VMware virtual machine files! ๐ ๐พ **Save this guide** in case you need it in the future. Happy recovering! ๐ปโจ