Wrong drive letter and can't boot Windows 7 after disk swap

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.

Comments

Add new comment

Default

  • Use [fn]...[/fn] (or <fn>...</fn>) to insert automatically numbered footnotes.
  • You may link to images on this site using a special syntax
  • Web page addresses and e-mail addresses turn into links automatically.
  • To post pieces of code, surround them with <code>...</code> tags. For PHP code, you can use <?php ... ?>, which will also colour it based on syntax.
  • Internal paths in single or double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or path. Paths to files in single or double quotes, written as "files:somefile.ext", for example, are replaced with the appropriate URL that can be used to download the file.
  • Filtered words will be replaced with the filtered version of the word.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <q>

Issue

  • Lines and paragraphs break automatically.
  • To post pieces of code, surround them with <code>...</code> tags. For PHP code, you can use <?php ... ?>, which will also colour it based on syntax.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>

Drinking Game

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <p> <br> <pre> <h2> <h3> <h4>
  • Images may be embedded like: [image:node_id align=alignment hspace=n vspace=n border=n size=label width=n height=n nolink=(0|1) class=name style=style-data node=id] Leave off any attributes you don't want.
  • [img_assist|...] tags will be displayed, maybe. Please don't make more of them.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Refresh Type the characters you see in this picture. Type the characters you see in the picture; if you can't read them, submit the form and a new image will be generated. Not case sensitive.  Switch to audio verification.