Fix partition issues relatively safely with P2V and V2P


I foolishly decided to convert a Windows operating system drive from MBR partitioned to GPT partitioned. That conversion didn't go right. The boot portion of the drive was erased or destroyed. The partitions were still there and no data was destroyed.   I tried to convert the drive back to MBR.  That didn't work easier.  This is usually the point where you might start panicking.

The cycle time is pretty long when you try and fix the boot portion of a physical disk.  There are continual physical machine restarts.  There is also risk that data will be lost while attempting to fix this. I wanted to attempt drive repair without risking destruction of data on the drive I was working on. In addition, I didn't want to work on this drive without access to the internet.

My target laptop laptop has two bootable drives in it.  I realized that I could convert the trashed disk from Physical to Virtual using Paragon Drive Copy. Then I could hack on the virtual drive without risking losing data. Bad mistakes could be "undone" by running P2V again to rebuild my virtual disk.

Tools used:

  • Paragon Drive Copy P2V to create virtual disk images of my physical hard drive
  • Windows installation ISO for system repair
  • VMWare Player
  • Paragon Drive Copy V2P to clone the virtual disk image back onto the physical disk
  • Google to find out what kinds of commands might be needed.

Short version

  1. Convert physical disk to virtual, vmdk in my case
  2. Create Virtual machine with newly created disk and Windows installation ISO
  3. Boot the virtual machine from the ISO and use the Windows recovery tools to repair the virtual disk/machine.
  4. Clone the repaired virtual disk back to a physical disk

Longer version

P2V

Paragon Drive Copy converted the physical disk to virtual. I then created VMWare virtual machine that mounted that virtual disk as its primary and attached a Windows ISO as the boot CD.

Create the VM

  1. Create a new VMWare VM using VMWare Player using the ISO as the installation media and the VMDK created by P2V as the hard drive.  The VMWare New Machine Wizard didn't let me create a VM with an existing vmdk. 
  2. Edit the machine configuration before running it. Add the P2V vmdk and remove the empty one created by the wizard.
  3. Boot the VM.  It should boot from the ISO by default.
Note: You can give time to boot to bios by adding a boot delay where the time is milliseconds.  The following vmx file entry waits 5 seconds for user input before continuing the boot process.
bios.bootDelay = "5000"

Repair

This let me boot the VM in recovery mode. The disk was fixed and bootable with about 1-2 hours of system recovery disk work. Most problems can be fixed with just the windows recovery disk.  My problems were a little more complex :-(

Note: I ended up deleting my recovery partitions, rebuilding the MBR and then letting the windows recovery process make it bootable.

  • bootrec /fixmbr
  • bootrec /fixboot
  • ren c:\boot\bcd bcd.old
  • bootrec.exe /rebuildbcd
  • bcdboot c:\windows
"x:\sources\recovery\StartRep.exe" runs the recovery app.
"bcdedit" tells your your boot config

V2P

Paragon Dive Copy documentation says it supports Virtual to Physical (V2P).  It turns out you do this by mounting the virtual drive with Drive Copy.  This makes the (newly repaird) virtual drive look like a physical disk.  I was then able to clone the virtual disk onto the original physical drive.  The clone operation copies all the partition and boot information.

Paragon Drive Copy

There are plenty of disk cloning tools out there. I used Paragon Drive Copy because I own a copy and have had good luck with it in the past.
  • P2V: There is a button on the Paragon Drive Copy ribbon bar that does this.
  • V2P: This is done by cloning a mounted virtual drive.

P2V and V2P can be useful tools when trying to fix certain types of disk issues.



Comments

Popular posts from this blog

Understanding your WSL2 RAM and swap - Changing the default 50%-25%

Installing the RNDIS driver on Windows 11 to use USB Raspberry Pi as network attached

DNS for Azure Point to Site (P2S) VPN - getting the internal IPs