I have a system which dual-boots Gentoo Linux and Windows 7 using GRUB2. The computer has four drives, and Windows is installed on the third (last) partition of drive #2. The drive layout looks like this:
|boot|-----------------home-----------------|-------------windows-------------|
(boot
and home
are Linux partitions) It's an odd setup but it always worked, until I decided to shrink the Windows partition using Gparted. The new layout is:
|boot|-----------------------home-----------------------|-------windows-------|
After making these partition changes, when I select the Windows option in GRUB2 and it hands off control to the Windows bootloader, I get the error message:
Windows Boot Manager
Windows failed to start. A recent hardware or software change might be the cause. To fix the problem: 1. Insert your Windows installation disc and restart your computer. 2. Choose your language settings, and then click "Next." 3. Click "repair your computer." If you don't have this disc, contact your system administrator or computer manufacturer for assistance. Status: 0xc0000225 Info: The boot selection failed because a required device is inaccessible.
I'm not particularly surprised that this happens, but I'm wondering if I can fix this without reinstalling Windows.
I've tried booting the computer using the Windows installation DVD (specifically, a Windows 7 upgrade DVD). After I choose the language and keyboard and click "Repair this computer", the System Recovery Options screen doesn't detect my Windows partition. I can click "Next" anyway and then use Startup Repair, which fails to fix the problem, or try command-line tools, namely bootrec
(suggested by several websites), sfc
, and chkdsk
. None of them made a difference; I still get the same error message. (See below for detailed output.)
Also as suggested in similar questions, I tried using the "Rebuild BS" (rebuild boot sector) functionality in TestDisk, running under Linux, acting on the Windows partition. That also did not change the error I get.
I haven't seen any signs of data corruption on either partition, and the drives haven't suffered any physical damage, so it seems fairly certain that the change in partition layout is the cause of this error. I suppose Windows must have the starting sector and/or partition size stored somewhere within its filesystem (the registry?), suggesting that it should in principle be possible to fix this by twiddling a couple bytes in a file somewhere. But which file? Or is there something more complicated?
If it helps, here is the GRUB2 configuration section corresponding to Windows:
menuentry 'Windows 7 (loader) (on /dev/sdb3)' --class windows --class os $menuentry_id_option 'osprober-chain-1F9948EB30A986A0' {
insmod part_msdos
insmod ntfs
set root='hd1,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos3 --hint-efi=hd1,msdos3 --hint-baremetal=ahci1,msdos3 1F9948EB30A986A0
else
search --no-floppy --fs-uuid --set=root 1F9948EB30A986A0
fi
chainloader +1
}
Again, what I'm looking for is, ideally, a way to fix this without reinstalling Windows. If that's not possible, then reinstallation is an acceptable plan B, but I can handle that myself.
Here's a transcript of my command prompt sessions while booted into the repair environment using the Windows 7 installation DVD. I've removed some blank lines for readability. The following is with all other drives disconnected:
>bootrec /fixmbr
The operation completed successfully,
>bootrec /fixboot
The volume does not contain a recognized file system.
Please make sure that all required file system drivers are loaded and that the volume is not corrupted.
>bootrec /scanos
Scanning all disks for Windows installations.
Please wait, since this may take a while...
Successfully scanned Windows installations.
Total identified Windows installations: 1
[1] C:\Windows
The operation completed successfully.
>bootrec /rebuildbcd
Scanning all disks for Windows installations.
Please wait, since this may take a while...
Successfully scanned Windows installations.
Total identified Windows installations: 1
[1] C:\Windows
Add installation to boot list? Yes(Y)/No(N)/All(A):y
The volume does not contain a recognized file system.
Please make sure that all required file system drivers are loaded and that the volume is not corrupted.
>sfc /verifyonly /offwindir=C:\Windows /offbootdir=C:\
Beginning system scan. This process will take some time.
Windows Resource Protection did not find any integrity violations.
>chkdsk C: /F
The type of the file system is NTFS.
Volume label is windows.
CHKDSK is verifying files (stage 1 of 3)...
313344 file records processed.
File verification completed.
1684 large file records processed.
0 bad file records processed.
2 EA records processed.
158 reparse records processed.
CHKDSK is verifying indexes (stage 2 of 3)...
416370 index entries processed.
Index verification completed.
0 unindexed files scanned.
0 unindexed files recovered.
CHKDSK is verifying security descriptors (stage 3 of 3)...
313344 file SDs/SIDs processed.
Security descriptor verification completed.
51514 data files processed.
CHKDSK is verifying Usn journal...
35406088 USN bytes processed.
Usn Journal verification completed.
Windows has checked the file system and found no problems.
207510871 KB total disk space.
104134880 KB in 251224 files.
137304 KB in 51514 indexes.
0 KB in bad sectors.
423075 KB in use by the system.
65536 KB occupied by the log file.
102815612 KB available on disk.
4096 bytes in each allocation unit.
51877717 total allocation units on disk.
25703903 allocation units available on disk.
Failed to transfer logged messages to the event log with status 50.
>diskpart
Microsoft DiskPart version 6.1.7600
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: MININT-P92LVUL
DISKPART>list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 596 GB 0 B
DISKPART>select disk 0
Disk 0 is now the selected disk.
DISKPART>list part
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 Primary 62 MB 31 KB
Partition 2 Primary 398 GB 62 MB
Partition 3 Primary 197 GB 398 GB
When I run the same commands with all drives connected, the output is the same, except that diskpart
correctly shows all the drives, and the drive letter for the Windows partition in question is D
instead of C
(because I have an NTFS data partition on drive #1).
I would note that bootrec /fixmbr
overwrites the MBR of drive #2, replacing the MBR put there by GRUB2. When I then try to boot from that disk, I simply get the message "Missing operating system" instead of the 0xc0000225 error. I can then boot into Linux and use grub-install
to put back the GRUB2 MBR, and then choosing the Windows option in GRUB2 gives 0xc0000225 again.