I just got a nice Samsung EVO 850 SSD, and therefore got the chance to remove two spinning disks from my PC. But in order to make this happen, I had to move Windows to the SSD I had in my PC already. So I mounted the new SSD and formatted it ext4, and transferred Linux without a hitch. Then I booted up and used gparted to transfer Windows to the old SSD I'd just vacated, and it wouldn't boot. I thought these problems were over? I used my Linux install (with vmware player) to fix the problem just as I had used it (with gparted) to copy Windows from one volume to another.
As it turns out, the solution was relatively simple, once I'd googled up some help. All I had to do was scrub grub and repair the boot files. Oh, yeah, and change the drive letter. My system has a reserved partition created when Windows was installed. I don't know why, but I didn't want to blow it away, so I kept it around. But it got assigned C: and my boot device became D:. As it turns out, you can fix all this stuff from the install disc even if it can't recognize your Windows install right away.
I went ahead and created a Windows 7 virtual machine in VMWare Player 5 which specified the boot disk as the boot volume, so that I could play around with the system without having to actually reboot. Then I booted it from an ISO of the Windows 7 DVD, which permitted me to enter system repair. That didn't manage to detect an operating system, but you can still choose to start recovery tools, then start the console. At this point, you launch diskpart
and start fooling around.
Diskpart
Diskpart is a fairly full-featured disk partitioning tool which also works with Windows' software RAID capabilities. We don't care about those right now, though; all we care about is some simple commands like assign and remove, as well as "list volumes" (or just lis vol
, abbreviated) and "select volume" (sel vol
) plus a number. So we'll lis vol
and get the volume numbers from the left column, then set vol n
where n
is the volume number of the drive which is currently known as "C". Then you can type remove letter=c
to remove the drive letter. Skip this step if you don't have a C, but your boot volume is set to C anyway. Regardless, you can now sel vol x
, where x
is the number of the volume you want to be C:, you can remove letter=d
and then assign letter=c
. Now you can exit
diskpart and move on to fixing the boot files.
Boot Files
If you've had to use diskpart to change your drive letter, now is a good time to type c:
and get there. Now you can run bcdboot and the various bootrec commands to install and repair the boot loader:
Bcdboot C:\windows
BOOTREC /FIXMBR
BOOTREC /FIXBOOT
BOOTREC /REBUILDBCD
BOOTREC /SCANOS
First, you install the boot files. Then, you fix the Master Boot Record. Then, you fix the boot files. Then, you rebuild the boot configuration. Finally, you scan for installed copies of Windows.
After I made all of these changes, the system booted right up just fine. At this point you can also run update-grub
on the Linux side to detect your Windows install and add it to the grub menu. However, for some strange reason I can now boot from the NT Loader but I can't chainload it from GRUB. Perhaps there will be more on this subject later... In the meantime, my BIOS' boot device selection screen is coming in handy.
Typo not "set" but "sel" in Diskpart
It does not work when using "set vol" in Diskpart. Its "select vol"/"sel vol" instead.
Fixed, thanks
Fixed, thanks
Thank you!
You saved my behind, much aappreciated!