Friday, July 31, 2015

Cloning a Mac / Bootcamp disk to a larger drive

OWC and others recommend that you do a fresh installation when moving a Mac with Windows BootCamp to a larger drive.  That is probably a good idea.

Sometimes you just decide to do things the hard way. This is what I did for my Macbook Air when I bought a larger SSD.  It had OS/X on the first partition and Windows 7 on the second partition.


  1. Backup your data.
  2. Create a Clozilla bootable thumb drive.
  3. Get an OWC drive with external case. Plug in the new srive in the external case.
  4. Boot Clonezilla from the thumb drive. 
  5. Make a disk to disk copy. 
    • This makes an exact duplicate of the drive.
  6. Clone the internal disk to the new larger external disk.
  7. Power off the machine
  8. Remove the old disk. Install the new disk inside your machine.
  9. Boot into the mac OS on the disk you just installed.
  10. Download and use gdisk 
  11. Use gdisk to copy the MBR/GPT info to the end of the new drive.
  12. Boot into the Windows OS
  13. Run the check disk utility to verify the disk.
  14. Download Mini Tool Partition Wizard
  15. Use MTPW to extend the windows partition to fill the disk.
  16. Restart into OS/X
  17. Use CampTune to reallocate some space from the Windows partition to the OS/X partition.
    • CampTune may tell you it needs to re-align the MBR and GPT.  Let it.
  18. Party like its 1999.

Sunday, July 12, 2015

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.