Disclaimer: This entry is focused on both Windows and Linux…but, I’m sure people will have this same issue, so I will detail my steps.
Recently, I decided to reinstall Linux on my desktop (gave up after KDE 4.0 was released and I loathe Gnome) after seeing how much KDE has improved, and went through the process. Mind you, I did all of this via a USB drive, as I have no working optical drive. I dual-booted Kubuntu 10.10 with Windows 7 Premium (x64 for both), and everything went fine. Or so I thought.
I could boot into Kubuntu just fine after the install. Installed programs, programmed a bit, and ventured around a little to get the feel of Ubuntu/Debian-based systems again (too used to Arch Linux). Long story short of re-enjoying KDE/Linux, I rebooted to start Windows back up to make sure I didn’t screw anything up, and…this is where the story starts.
I got the following error whenever I booted Windows 7:
0xc0000225 Boot selection failed because a required device is inaccessible.
Here, I thought it would be a simple fix. I rebooted again into Linux, and searched high and low along the Interwebs’ wall of information. I tried a bunch of fdisk tricks (most of which wouldn’t work as I was currently on the mounted drive and couldn’t unmount it), cfdisk would fail saying that the partition table is invalid. Something similar between (c)fdisk is that it gave a partition table error (don’t remember the errors off the top of my head, but basically invalid cylinder ranges).
Everywhere I read on the Internet said that this was something to not be worried about…well, they didn’t want to boot back into Windows 7 apparently. I Google’d the fdisk error (as I know cfdisk is very finicky about everything), and everyone just did the short/easy route, reinstall both OSes. This wasn’t very viable to me, just because I didn’t feel like making a USB bootable of Windows 7 for the nth-time now. So, I took it a different route…I Google’d the Windows error I received. That is what solved my problem.
Step #1: Download the Windows 7 Rescue Disk
Microsoft was smart with Windows 7, and offered a rescue disk for those who dared to do silly and things. Download the version of the disk that corresponds with your version of Windows 7 (i.e.: x64 for x64 installs).
Step #2: Format the USB as NTFS (if it’s not already; if it is, then delete whatever is on it)
I’m not going to go into how to delete contents of a USB drive, but to format one as NTFS, use mkntfs. The command I used (my USB was /dev/sdc) is:
You have to specify the partition number to format. You could optionally use the -Q (quick format) switch, but I had things to occupy myself with anyways so I let it do it’s own thing…took about 45 minutes. It’ll zero-out the partition (which takes the longest) and then do the formatting.
Step #3: Mount the USB
I let KDE do it by itself by unplugging and replugging in the USB device. But, if you don’t want to, you can easily use the mount command again:
mount /dev/sdc1 /mnt/usb
Again, /dev/sdc1 was for me, it might be different for you. The second option is the path where to mount the device, just make sure it exists and is empty.
Step #4: Copy over the ISO content
This one is probably the easiest step, to me. Command:
Now, I’m not gonna lie, I kind of cheated here and use UNetBootin. Reason being is that it combined about 2-3 steps into one. You can get this software at http://unetbootin.sourceforge.net/ and it will run on Linux and Windows. For those on Ubuntu-based (and probably Debian as well) systems, you can use apt-get install unetbootin and it’ll install for you.
All you have to do is choose to use a disk image (ISO) file (second radio button). Choose your Windows 7 rescue disk ISO you downloaded, and choose “Show All Drives”, choosing USB as the type. The reason why you mounted the drive earlier was because at this stage, if you don’t, it won’t let you use your drive until you do mount it. So, choose your drive partition (i.e.: /dev/sdc1) and continue on. It’ll copy over the files, and install a boot loader.
Step #5: Reboot and Run System Repair
Reboot your computer and choose to boot the USB (this varies from motherboard to motherboard, most of the time you’ll choose HDD or USB-HDD). You let the rescue disk find your Windows partition, and then choose “Startup Repair”. Some people say you should do this 3 times, but I just had to do it once. It’ll fix the partition table that got fubar’ed and then click “Finish” to reboot.
At this point, Windows 7 should be booting just fine now.
I’m not sure if this only caused by Ubuntu or not, but most of the time it’s more of an issue with resizing a Windows partition (which is what I did to cause a partition table boo-boo).