How can I rebuild the Windows boot files?
After a virus, the boot files on a Windows 7 computer are gone, and I get this message when booting...
File: \Boot\BCD
Status: 0xc0000000f
Info: An error occurred while attempting to read the boot configuration data.
So I booted from my Windows 7 USB thumb drive and opened the command prompt. I mounted the drive with the OS install to the L: using diskpart
, and then I changed to the L: drive then typed the following
L:\>bootrec /fixmbr
Command completed succesfully
L:\>bootrec /fixboot
Command completed succesfully
L:\>bootrec /rebuildbcd
I say I want to add the Windows install on L: so I type Y hit Enter and I get The requested system device cannot be found
.
So how do I rebuild the Windows boot files; why can't the system device be found?
Below is a log of the commands I run as well as the windows usb install drives' attempt to repair it
When I click repair computer Windows scans for Windows Installs and then pops up this dialog
[[System Recovery Options]] <-- Title
Text is.... (no '-' though) -------------- Windows found problems with your computer's startup options. Do yo want to apply reparis and restart your computer?
View deatails
Then the buttons
[Repair and restart] [No]
When I click View details I get another dialog
[[Systen Recovery Options]]
Repair details: (then a scroll box with the deatils) The following startup option will be repaired: Name: {bootmgr} Identifier: {9DEA862C-5CDD-4E70-ACC1-F32B344D4795}
The following startup options will be added: Name: Windows 7 Home Premium (recovered) Path: Windows Windows Device: Partition=D: (595364 MB)
Name: Windows Recovery Environment (recovered) Path: Recovery\WindowsRE\Winre.wim Windows Device: Partition=C: (15000 MB)
A copy of the current boot configuration data will be saved as: C:\Boot\BCD.Backup.0002
[Close]
So I click Repair and restart and get
A error dialog that says [[System REcovery Options]]
X Failed to save startup options
[Ok]
So I click Ok
and get the normal windows that allows you to retore from an image or try and use recovery tools
Selected either options and clicking next gives me a dialog to Choose a recovery tool and buttons at the buttom to shutdwon or restart
So I open cmd and type the following
Microsoft Windows [Version 6.1.7600]
X:\Sources>diskpart
Microsoft DiskPart version 6.1.7600 Copyright (C) 1999-2008 Microsoft Corporation. On computer: MININT-8COAH39
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status
Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 E DVD-ROM 0 B No Media Volume 1 C Recovery NTFS Partition 14 GB Healthy Volume 2 D OS NTFS Partition 581 GB Healthy Volume 3 F Removable 0 B No Media Volume 4 DELLUTILITY FAT Partition 100 MB Healthy HiddenDISKPART> select volume 2
Volume 2 is the selected volume.
DISKPART> assign letter = l
DiskPart successfully assigned the drive letter or mount point.
DISKPART> exit
Leaving DiskPart...
X:\Sources>L:
L:>bootrec /fixmbr The operation completed successfully.
L:>bootrec /fixboot The operation completed successfully.
L:>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] L:\Windows Add installation to boot list? Yes(Y)/No(N)/All(A):Y The requested system device cannot be found.
L:>bcedit 'bcedit' is not recognized as an internal or external command, operable program or batch file.
L:>
Try these general steps:
- Make another install of windows on the same disk on the same computer in a different partition. (Shrink your Windows partition and make a 30GB one, then install 7 in that.)
- Copy all of your boot files from the new install to the broken one using a Linux LiveCD (I would recommend Ubuntu as it comes with GParted, software which will allow you to do the aforementioned partitioning changes)
- Select your old 7 install from the boot menu and see if it works. If it does, delete the new partition and run startup repair.
- If it doesn't doesn't, consider using a Linux LiveCD (I prefer Ubuntu, a very user-friendly distro) to copy your data over to a new install of Windows, either disk-to-external-media-and-back-to-disk or just into a new Windows partition.
I have had the same problem... after two days of various trials, I tried:
bcdboot c:\windows
But it did not work for me so I tried:
bcdboot c:\windows /s c:
And all boot files were copied and the system is back online.
Assuming that c: is your system drive, and Windows is installed to the \Windows subdirectory, try running:
bcdboot c:\windows