By SQL Server MVP Ami Levin
Today I want to share with you a true story that happened to me last week. Although a bit off-topic, you might find it 'amusing', useful and a real time saver in case you ever need to do the same thing.
When I bought my desktop PC last year, I purchased an SSD drive to be used as the system drive (C:\). At the time, the prices of SSD devices was pretty steep so although I had some doubts, I convinced myself that a 40GB drive should be more than enough to accommodate everything I need. Big mistake #1. As it turned out, only the I-tunes backups of my iPhone which (for some reason) can be placed only on C:\ took 16GB... Add to that my SQL Server installation, office and other essentials. Most of these applications, even when installed to a different drive, still place a lot of stuff on the system drive so soon I found myself struggling for space and using every trick in the book to free up as much space as possible on C:\ just to be able to work.
When I decided it's time to install SQL 2012 on the host O/S and stop using it in a VM, I realized that no tricks will help me now - I need a larger drive. Happily I went to my local hardware dealer and purchased a shiny new 128GB SSD. Since I didn't want to install the O/S from scratch, I looked around for disk imaging software to clone my original disk onto the new drive. Should be simple and straight forward... right? well, I was about to find out the harsh reality soon enough.
A quick search on the internet revealed quite a few disk cloning utilities, some of them free, that claim to do the job. Some even had great reviews so I quickly downloaded one, installed it and was extremely happy to receive the message "Disk Clone Completed Successfully". I changed the BIOS boot sequence, restarted the PC and received the cheerful message "BOOTMGR is missing". I said OK, no harm done and quickly reverted the BIOS settings back, restarted the PC, and guess what - the same message again. No worries. I booted into windows recovery console which confirmed there is an issue with windows start-up and suggested to fix it for me, which it actually did successfully. Booting back from my original drive succeeded and a quick look into windows logs revealed that windows blocked the cloning utility from gaining access to the boot sector. So much for "Successful cloning" within Windows.
I didn't give up. If I can't clone from within windows, I surely can clone from outside windows, right? I downloaded a great boot disk (UBCD) pre-installed with many disk utilities, booted into its windows XP PE (Pre-Installation) environment and it happily cloned the disk for me, this time successfully (or so I thought). I removed the old disk and plugged in the cloned copy in it's place. Restarted the PC and now it simply hung after the BIOS messages with a small blinking cursor at the top left corner of the screen. No worries, no harm done. I have the magical windows recovery console which worked great last time! I placed the windows DVD back in the drive, rebooted and indeed it again found a problem with windows start-up. I clicked "Repair" and got the message "Successfully repaired your windows installation". Happily I rebooted again, and my old friend, the top left small blinking cursor appeared again and the PC just hung. No worries! I quickly plugged in the old disk back and moved the new disk to another slot, and rebooted again. This time, windows boot menu appeared and now I had not one, but 2 "Windows 7 Ultimate" installations which I was asked to choose from. However, this time both of them actually worked. One booted from the old disk and one from the new one. But now I encountered a new issues. No matter which one I booted, the new drive was recognized as E:\ and not C:\ but worse than that, the 128GB disk was identified by disk manager as having just 40GB although its hardware properties showed the correct size. Trying to extend the partition was strictly refused by windows with the very informative error message "Parameter is incorrect". After a few futile attempts to get this configuration working using some really scary utilities modifying internal disk properties, and as I was about to give up about 4 hours into the job, I gathered my strength again and decided to try a different approach. I realized that windows 7 has a built in imaging utility for disaster recovery that should be able to do the trick. On we go.
I deleted the partition from the new disk, booted again only to find out windows still thinks I have 2 operating systems. In the old days we had boot.ini which could be manually edited but it's no longer there in windows 7. Sigh, take a deep breath - I can live with that. Windows was more than happy to perform an image for me (note that you must have a 3rd drive to store the image on). I removed the old disk, plugged in the new one, booted again into windows recovery console. When I asked to restore an image, it searched the disks for me, found my recent image and suggested to restore it. Delighted, I clicked "YES!" please restore my system on the new drive, only to receive a new error message "No suitable disk found to restore the image on". I checked again, the new disk was identified correctly by the BIOS, and even by windows itself in the "Exclude disks" list. So why won't it restore the image on it??? At this point I was really pulling my hair out (and I don't have much of it...) but I didn't give up. I remembered my wonderful boot disk with all its low level disk utilities, it must find if there is something wrong with it. Again I booted into windows PE, and tried ALL available diagnostics on it. Nothing was found wrong. I used everything I could think of - removing MBR, wiping the disk clean with every possible utility but to no avail. Windows simply decided it doesn't like my new disk and won't restore the image on it.
I was just about ready to bite the bullet and re-install windows from scratch, when I remembered that windows recovery console comes with a partition utility of its own called "Diskpart". As a last resort, I tried it. SELECT disk 0 (yes - that's diskpart language) followed by a CLEAN command finally did the trick. I rebooted, windows agreed to recognize the new disk, restore the image on it and even agreed to extend the partition to the full 128GB. At last, I have my old O/S, running on the new disk and utilizing its full capacity. Yes, there still were some minor "leftover" issues and errors but nothing I can't live with.
All in all, it took more than 7 hours of work and a lot of frustration to make this work. I was also very happy that I bought a heavy duty PC case which only suffered minor "frustration dents" in the process :-)
BTW - I also managed to fix the boot menu issues with this really cool boot manager (free for personal use) from http://neosmart.net/EasyBCD/
So to sum up my lessons from this experience: