Recently at work I helped a colleague migrating his laptop from a HDD to an SSD. He was dual-booting his machine with Windows 7 and Ubuntu, and after skillfully shrinking his original partitions (in order to fit the SSD), we copied the partitions over with dd from the HDD to the SSD. After that was done, Grub was understandably confused as its entries were pointing to the HDD partitions rather than the SSD partitions but even after an update-grub and grub-install from within Ubuntu, Windows still wouldn’t boot.

We consistently got stuck at “Preparing your Desktop” screen and eventually Windows would boot into a completely empty desktop.

Keep reading to figure out how to fix this.

Even though my Windows skills have rusted from having fully migrated to Arch Linux a while back, I still remembered you could run programs from the task manager which, conveniently, is still possible to launch using the Ctrl+Alt+Del combination. Having done so allowed me to diagnose the problem: when I ran cmd.exe, Windows was mounting the SSD partition from which I was trying to boot as F:\ rather than C:\ where Windows expected everything to be.

The fix, after you know what to do, is simple-ish.

Essentially you need to change your registry (you know, regedit) and remove all the letter mappings so that Windows will remap all your drives again at boot.

Easy right? Just launch regedit and edit away! But NO! Because you will, with 100% certainty, not be able to launch regedit!

So what’s the solution then, how can you edit your registry without actually being able to boot into Windows?

Nice question! We do it from Ubuntu using a nifty tool called chntpw which was originally developed (I assume… based on the name…) to change the password of NT-based systems.

So! Jump on Ubuntu, get yourself chntpw installed (seriously, if you don’t know how to do this, get a friend to help you as the next steps are VERY sensitive!) and do the following steps:

  1. Mount your Windows partition (from now on called ). </li>
  2. Run chntpw -i /Windows/System32/config/system (N.B. Windows is not case-sensitive but Linux is! Therefore, your file might be called SYSTEM). </li>
  3. From the menu, choose option 9 (Registry Editor).
  4. Now if you type “ls”, one of the items should be “MountedDevices”.
  5. Enter it by typing “cd MountedDevices”.
  6. Again if you “ls”, a number of entries should appear, including all your drive letter mappings (we’re almost there!).
  7. Now, I had no success actually changing the mappings so I ended up simply removing all the mappings and letting Windows remapping on the next boot. To do so type ” dv \DosDevices\C:” and repeat this command for all the mapped letters in your computer.
  8. Do “ls” one more time to confirm the mappings have been deleted.
  9. Choose option “q” to quit chntpw followed by “y” to confirm writing the registry hive file.
  10. TADA! You’re done! Boot into Windows and it should finally boot correctly.
  11. </ol>

    Let me know in the comments if you’re stuck in some step and I’ll gladly give a hand!

    Till the next time!

    [Credit]