Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!
Showing posts with label BCD. Show all posts
Showing posts with label BCD. Show all posts

Wednesday, September 26, 2012

BCD 0xc000000f Error

How To Fix Boot/BCD 0xc000000f Error This article is specific to Windows 7 but similar errors occur on Vista and Windows 2008/R2.
After rebooting your computer you receive the following error:
Windows Boot Manager
Windows failed to start. A recent hardware or software change might be the cause. To fix the problem:
1.insert windos cd and run a repair your computer option.
File: /boot/bcd
Status: 0xc000000f
Info: an error occurred while attempting to read the boot configuration data.
You may receive a similar error which lists the error code as 0xc0000034 or missing file: \windows\system32\winload.exe instead.
You may also receive further errors after trying to repair the bcd store using bootrec and bcdedit as follows.
The requested system device cannot be found.
The “Windows Boot Configuration Data File is Missing Required Information
The “Windows Boot Configuration Data File is Missing
An error occurred while attempting to read the boot configuration data
Cause and Fix
The most likely cause of this error is that you tried to dual boot two operating systems and then later decided to remove one. This inadvertently may have deleted the bcd boot store. The trick here is to run the above commands in the right order and set your boot partition to active. Let’s get started.
Make sure your boot partition is set to Active
Boot from your DVD and choose the repair option. From the recovery console type “diskpart” and press enter and then type “list disk” to get a list of physical disks installed.
Running diskpart to fix bcd bood errorIn the example here I only have one disk in my machine, if you have more than one identify the disk which has the Windows boot partition on it and then select it. Select it by typing “select disk 0″ (in my case). Now type “list partition”. The Windows 7 boot partition is a 200 MB primary partition. As you can see here it was on disk 0. Select it by typing “select partition 2″ or whichever number matches your 200MB partition.
Set the partition to ActiveNow type “detail partition” and look where it says “Active”. If it says yes then move onto the next section otherwise type “Active” and press enter, Windows should report the partition is now marked as active. Now reboot and boot into the recovery console again.
Repair the MBR and boot sectors
From the recovery console run these commands in this order:
  • bootrec /fixmbr
  • bootrec /fixboot
Now reboot the machine again into the recovery console and type “bcdboot path to your windows folder“.  Your windows folder will normally be c:\windwows but in the recovery console it may show up as D:\windows so make sure you get the path right. In my case it was “bcdboot d:\windows”. This will will build a new bcd boot store and copy over all boot files needed to boot. Now reboot your machine one last time and it should work. If it doesn’t run the two bootrec commands again.
If you have any additional operating systems you want to add use the bootrec /scanos command.
If you still have issues you may have a system with a GPT disk. In this case you will have an EFI sytem partition that must always be active. See the following if you get Failure when attempting to copy boot files or suspect you have an EFI system.

Saturday, April 28, 2012

\Boot\BCD error 0xc000014c

\Boot\BCD error 0xc000014c
Doing a repair install, using something like Testdisk to re-writed the mbr is about the best way I can see
a description of writing the mbr code with that is right here
MBRCode
If you use this command, TestDisk will overwrite the code area of your disk necessary for booting the operating system(s). This might be useful if your system doesn't boot at all, and you've tried everything else! See below for details on how this new MBR will function on your system.
IBM PC/Intel partition
If you use this command, TestDisk will overwrite the present code area of your Master Boot Record (MBR) and write the MBR signature (the Hex Word 0xAA55) to your drive's MBR sector. Beginning with version 5.7 of TestDisk, new MBR code was created specifically for TestDisk by Neil Turton (the author of mbr-install; version mbr-1.1.8 includes the source code for the TestDisk MBR). This change means that TestDisk is now 100% GPL (Open Source) code.
Versions prior to 5.7 overwrite the MBR code with a copy of the Standard Master Boot Record (similar to MS-DOS's fdisk with the 'undocumented' /MBR switch). For a fully-commented copy of this DOS standard (or 'Classic') MBR code, see An Examination of the Standard MBR (edited copy for CGSecurity.org; France) or An Examination of the Standard MBR (The Starman's web site).
The TestDisk MBR
If you use TestDisk to write its MBR code to the first sector of your hard disk, it will very briefly identify itself by displaying TestDisk on the screen at boot up. The code is programmed to try booting up from whatever Boot Sector resides in the first partition of the drive. If that's not possible, you will then see a mini-menu displayed on your screen like this:
TestDisk

1234F:
Pressing the 1, 2, 3 or 4 keys on your keyboard, will command the MBR to try booting up from any boot sector(s) it finds in the 1st, 2nd, 3rd or 4th partition table entries in the MBR sector. Failing to do so will simply repeat the TestDisk MBR menu on your screen each time it fails to boot. If you press the F/f keys on your keyboard, the MBR will try to boot up the system from a floppy disk in your first (A:\ or /dev/fd0) floppy drive.
In most cases, once you're able to boot up your drive's original OS again, you'll want to change the TestDisk MBR code back to whatever you were using before encountering a boot problem. Note: Be sure you know exactly how to do that before proceeding - you don't want to remove your Partition Table again!
Back to Running the TestDisk Program

Wednesday, November 2, 2011

BCDEDIT Command Line Tool

Source  (copied and pasted) read more there!
Note
C:\Windows\System32\bcdedit.exe
To do with privileges, and is a good reason for not disabling UAC. Although you may be running as an Administrator, you are only running with standard privileges. In order to run as a true Administrator, you need to elevate.
Bcdedit is a really powerful tool that Windows Vista and Windows 7 uses to manage the boot loader entries.
BCDEDIT needs a boot loader file to boot your system.
A boot loader is a file that contains necessary information that instruct the system how to boot/start an operating system.
  • Windows 7 and Vista bootloader file is \bootmgr
  • Windows XP bootloader file is \ntldr
BCDEDIT can support other bootloaders too, like grub for linux. You just have to place the bootloader file on the root of the boot manager partition. e.g. \grldr and you have a grub boot loader enabled.
Bcdedit edits a file called bcd , which is located in Windows 7's hidden partition under \boot\bcd.
In Vista, its located under C:\boot\bcd.
USE
1. Open an elevated command prompt.

2. Type bcdedit and press enter.
NOTE: By typing just bcdedit you just list your boot entries.
Example:
Click this bar to view the full image.
A boot entry consists of 4 main elements:
1. Identifier
The identifier is how the system has named the boot entry.
2. Device
The device is the drive or virtual image that the system will use to boot the boot entry.
3. Path
The path is the location on the device where the bootloader file is found.
4. Description
The description is the friendly name we give to our boot entry, e.g. "Windows 7"
You see next to the identifiers their UUIDs in {}. The UUID is the unique codename that the system gives to each boot entry and cannot be changed.
The standard identifier UUIDs are explained below:
{bootmgr} = the boot manager
{current} = the OS you selected to boot at startup.
{default} = the default OS selected to boot the PC.
{ntldr} = Windows Legacy OS Loader (for windows xp)
there are others like {memdiag} or {ramdisk} but they can't be of much use right now.
warning   Warning
IMPORTANT: make a backup of your bcd file first. To do that, type:

bcdedit /export C:\SAVEDBCD

This will create a file c:\savebcd which is your boot entry backup.
If you mess up, you can always undo changes by:

bcdedit /import c:\savedbcd
Now to see how we can control the above entries, here are some examples:
bcdedit /set {current} description "My edited Windows Boot Entry"
NOTE: This changes the title of the boot menu entry "{current}".

bcdedit /set {ntldr} device partition=E:
NOTE: This tells bcd that Windows XP partition is drive E:

bcdedit /set {ntldr} path \ntldr
NOTE: This tells bcd that the ntldr file which is the winxp bootloader is on root folder "\" (of drive e: as stated above)

bcdedit /displayorder {ntldr} /addfirst
NOTE: This places Windows XP as the first OS on the menu list.

bcdedit /default {ntldr}
NOTE: This places Windows XP as the default OS to boot first with.

bcdedit /displayorder {33342343-3424-2342342342-2344} /addlast
NOTE: This tells bcd that the boot entry with UUID 3334... should be the last entry on the menu.
You can copy your existing VISTA or Windows 7 boot entry to another identical. Then you can change settings on the new entry to experiment. You will always have the first entry available, so it's safe to play with.
bcdedit /copy {current} /d "New Windows 7 boot entry I just copied!"
this will give you a line:
NOTE: The entry was successfully copied to {4c21825f-e04b-11dd-b760-00195b61617a}. The {4c21825f-e04b-11dd-b760-00195b61617a} is the UUID of the new entry that the system just created. Yours will be different than mine! This is its identifier and you should use this to address that entry. Example:
bcdedit /set {4c21825f-e04b-11dd-b760-00195b61617a} numpoc 2
NOTE: This adds the 2 CPU Core support during boot, like you do in msconfig.
bcdedit /deletevalue {4c21825f-e04b-11dd-b760-00195b61617a} numproc
NOTE: This deletes the numproc parameter from entry {4c21825f....}
bcdedit /delete {4c21825f-e04b-11dd-b760-00195b61617a}
NOTE: This deletes the boot entry {4c21825f....} completely. In order to delete an {ntldr} entry, you must use the /f switch to force deletion: bcdedit /delete {ntldr} /f
You can always type just bcdedit to see your current settings.
What else can I do with BCDEDIT?
You can use BCDEDIT to alter any boot parameter , like you would in msconfig, only more. BCDEDIT works from booting with installation dvd too, so it can be handy for recovery purposes.
bcdedit /timeout 5
NOTE: This sets the wait-to-select-OS menu timeout at startup to 5 seconds . You will notice that I didn't give a UUID above. If you omit the UUID, it applies automatically to the relavant UUID. So: bcdedit /timeout 5 is identical to
bcdedit /set {bootmgr} timeout 5
Some more advanced examples:
bcdedit /set {current} detecthal yes
bcdedit /set {current} detecthal no
NOTE: The above commands sets the detecthal to yes or no for entry {current}
To create a new boot entry to load Windows XP from a partition on your disk:
NOTE: The example below uses F: as the Windows XP partition. Replace with your xp drive letter.
bcdedit /create {ntldr} /d "Windows XP"
bcdedit /set {ntldr} device partition=F:
bcdedit /set {ntldr} path \ntldr
bcdedit /displayorder {ntldr} /addlast
Note   Note
Final note: BCDEDIT works from installation boot dvd too. If you mess up with a setting and you cannot boot, just boot from DVD and enter Repair Computer, then go to command prompt and there you go. You can play again with bcdedit to restore your system back.
------------------
Recovering the Vista Bootloader from the DVD - NeoSmart Technologies Wiki
--------------------------------
How can I configure it so that it wont offer a recovery option but starts windows normally? Or if offers then at least how can I configure it so that the "Start Windows normally" will be the default one in the list?
Answer
The default choice for the boot menu is in stored in "BCD-bootmgr-DefaultObject".
There is a utility called "Visual BCD Editor" - can be found here -> Free Windows BCD Editor - Windows 7 and Vista
This utility offers the full functionality of 'bcdedit' in an explorer like GUI. Moreover it is the first GUI utility to implement the full functionality of 'bcdedit'.
You can set your default loader choice by selecting the loader in the tree-view to the left, then click on the 'object' tab and in the tab click 'Set as Default Loader' button.
You can delete a loader by selecting the loader in the tree-view, right click, delete, confirm.
You can delete the menu entry for a loader by selecting {bootmgr} in the tree-view, then in Elements-view select 'DisplayOrder' and dbl-click. In the window that pops-up select the loader entry you want to delete, click on 'Delete' and then OK.
------------------------------
Windows always starts booting from first disk and active partition on that disk.
Boot sequence in short is:
MasterBootRecord, active PartitionBR, bootmgr (uses BCD from \boot), winload
Method 1:
1. Run Disk Management and check if Windows 7 is on the active partition. If not set the partition to active. (It is best if first partion is active)
2. Write MBR & PBR on Windows 7 disk (use bootsect.exe)
3. Repair/create Windows 7 boot files on Win 7 disk (bootmgr + \boot folder with BCD) (use bcdboot.exe)
4. In BIOS set Windows 7 disk to be first disk in boot sequence.
If you want detailed instructions post a disk map.
METHOD 2:
JUST UNPLUG VISTA DRIVE and Startup Repair - Run 3 Separate Times
----------------------------------------
I have CentOS 5.6 on my primary SATA drive. Windows 7 Ultimate is installed on second SATA drive. I did some edit of grub config to have Windows 7 boot from second drive and it works just perfect untill ... one note before. I use hd0, hd1 for drives decription - I guess, BIOS mimics PATA drives. sd0 sd1 don't work.
So, what happens. I can choose CentOS from hd0 or Windows7 from hd1 on grub loader menu and it works. Untill I installed one more Windows 7 instance on hd0. I can't boot hd1 Windows since. I tried to edit grub config: adding "mark active" and so. No help. Windows loader get's the control and doesn't boots from secondary drive.
Windows boot choice will help me, I guess. I understand bcdedit command, I see "bcd" file I need. what lines must be added to "bcd" to solve this?
Answer
The second instance of Windows overwrote your MBR, and failed to detect the first Windows on hd1. You can either work with the Windows loader, in which case I recommend EasyBCD, or you can repair the GRUB loader, which might be preferable since CentOS is your main OS. See TipsAndTricks/ReinstallGRUB - CentOS Wiki for some instructions for the latter.
When you say you marked Active, what did you mark active, and did you do so in GRUB, or in a partition manager?
feedback
not a case. If I take away new_Windows_7 from first hdd, grub boots old_Windows_7 from second hdd no problem. CentOS boots at any case.
I did it, actually. Now I can boot all CentOS systems from Grub and transfer boot control to Windows Boot menu. I can start Windows 7 from 2nd drive now. Sure, from the 1st also. Both versions of Windows works from c:. I like the automation. Volume letter is changing depending on which system is active even in boot loader configuration. Cool.
It is done from administration cmd prompt, a couple of bcdedit commands.
I don't need a EasyBCD unless it's for free

Thursday, September 30, 2010

bcdedit.exe and bootrec.exe

BCDEDIT - How to Use
forums.techarena.in/vista-setup-install/1128278.htm
 X:\Sources>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
> *Element not found.*
> So what's 'Element not found.'?

The element not found is when the rebuild tool is unable to detect the installation presently on the system. That can be for different reasons like the order you type the commands in. Try typing the bootrec /scanos entry before using the bootrec /rebuildbcd. Once successfully added you simply type the bootrec /fixmbr and /fixboot commands.

Another option if the BCD store itself isn't able to be rebuilt is to delete the present one. The second section seen on the MS page for this is at 'Error message when you start Windows Vista: "The Windows Boot Configuration Data file is missing required information"'
(http://support.microsoft.com/kb/927391)
The easier commands to use at the command prompt are:

X:\>
(c:) ????

bcdedit /export C:\BCD_Backup (C being used here for the single OS/system drive)
c:
cd boot
attrib bcd -s -h -r
ren c:\boot\bcd bcd.old
bootrec /RebuildBcd



bootrec /fixmbr
bootrec /fixboot
-------------------------------------------------- 


Use the WinPe setting in EasyBCD.
EasyBCD 2.2 - The NeoSmart Forums




Attached Thumbnails
Boot from .wim?-capture.jpg 
neosmart.net/wiki/display/EBC...r+from+the+DVD


Let's start by telling the recovery console to fix our MBR and bootsectors:
Replace x: in the commands below with the letter to your CD drive as detected by the Windows Recovery environment
bootrec.exe /fixmbr
x:\boot\bootsect.exe /nt60 all /force
Then ask it (nicely!) to try and rebuild your BCD data from scratch:
del C:\boot\bcd
bootrec.exe /rebuildbcd
If you're lucky, this'll work and you'll see a message telling you everything went OK.
Reboot your PC by typing in this command or by closing all the dialogs:
shutdown -r -t 0
Don't forget to remove your Windows Vista DVD or Recovery DVD from the drive!

Step Four: Nuclear Holocaust

Windows Vista doesn't have its share of haters for no reason: when the going gets tough, the tough gets going.
So Windows Vista can't even fix itself - god, that's what we love about EasyBCD! If you were in Windows Vista right now, you could have used EasyBCD's "Reset BCD Data" feature to have EasyBCD actively search for any and all discrepancies in your bootloader, zero out your old BCD data, and re-create it all from scratch. But you're not and it's no use lamenting what you could be doing with our super-cool app if you can't even use it in the first place now, is it? 
Go ahead and select "Command Prompt" yet again from that list. Roll up your sleeves, and prepare to be tortured.
The first order of business is to make sure the MBR and bootsector contain the right references to the Vista bootloader:
Replace x: in the commands below with the letter to your CD drive as detected by the Windows Recovery environment
bootrec.exe /fixmbr
x:\boot\bootsect.exe /nt60 all /force
Now we get rid of the old BCD registry, and create a new one instead.
Note: We're assuming that the boot drive is drive C: below. If your computer is configured differently, be sure to use the appropriate drive letter here instead.
del C:\boot\bcd
bcdedit /createstore c:\boot\bcd.temp
bcdedit.exe /store c:\boot\bcd.temp /create {bootmgr} /d "Windows Boot Manager"
bcdedit.exe /import c:\boot\bcd.temp
bcdedit.exe /set {bootmgr} device partition=C:
bcdedit.exe /timeout 10
del c:\boot\bcd.temp
Now we have a clean, working Vista bootloader. But we need to add a Vista entry to it:
bcdedit.exe /create /d "Windows Vista" /application osloader
bcdedit.exe should return a message with a GUID for the newly-created entry, something like this:
The entry {c0dfc4fa-cb21-11dc-81bf-005056c00008} was successfully created.
You'll need to use the value that bcdedit.exe returned for you below, along with the drive letter for the drive that Windows Vista is installed to:
bcdedit.exe /set {c0dfc4fa-cb21-11dc-81bf-005056c00008} device partition=C:
bcdedit.exe /set {c0dfc4fa-cb21-11dc-81bf-005056c00008} osdevice partition=C:
bcdedit.exe /set {c0dfc4fa-cb21-11dc-81bf-005056c00008} path \Windows\system32\winload.exe
bcdedit.exe /set {c0dfc4fa-cb21-11dc-81bf-005056c00008} systemroot \Windows
And, last of all, tell the Vista bootloader to boot the new entry by default:
bcdedit.exe /displayorder {c0dfc4fa-cb21-11dc-81bf-005056c00008}
bcdedit.exe /default {c0dfc4fa-cb21-11dc-81bf-005056c00008}
Now the Vista bootloader has been nuked and rebuilt from scratch. If you got this to work, feel free to consider yourself one of the finest graduates of the NeoSmart Technologies Institute of BCD Learning.
At this point, you have a clean, untouched, and (hopefully) fully-working bootloader with one entry for Windows Vista. Go ahead and reboot your PC, get into Windows Vista, and use EasyBCD to further tweak the bootloader to your heart's content. We advise backing up the BCD registry immediately with EasyBCD before making any changes.

http://www.sevenforums.com/installation-setup/67751-boot-wim.html
creating a 2 OS thumb drive

Sunday, September 19, 2010

BCDW and NTFS 6.1 OS

Source
BCDW is an excellent bootloader for CD/DVD's ONLY.
Syslinux/Isolinux/memdisk is another excellent bootloader that can be used on ANY media.
grub4dos is another bootloader that can also be used on ANY media.
This thread is (was) about .iso mapping of the Win7 repair disk (.iso inside CD/DVD - or other media).
BCDW cannot provide this kind of booting, AFAIK.
The nice link by cdob is about booting from "flat" directory on CD/DVD.
You can from BCDW chainload grub4dos:
http://grub4dos.sourceforge.net/wiki/index...r_DOS_from_BCDW
and from it load the .iso as shamurshamur reported.
Same can be done with Isolinux/memdisk:
http://bootcd.narod.ru/bcdw_e.htm#isolinux
The whole point is that since both Syslinux/Memdisk/Isolinux and grub4dos can directly load *anything* the previous passage through BCDW is an unneeded overlay.
http://www.boot-land.net/forums/index.php?showtopic=8258

Use either grub4dos or Syslinux .iso mapping, instead of BCD4W.
http://www.boot-land.net/forums/index.php?showforum=66
http://www.boot-land.net/forums/index.php?showtopic=5041

http://www.boot-land.net/forums/index.php?showforum=92
http://www.boot-land.net/forums/index.php?showtopic=8258
The idea is to use grub4dos to boot either the UBCD4WIN or the Windows 7 recovery iso.
Add "Repair disc Windows 7 32-bit.iso" file of about 142 MB to UBCD4WIN
Use grub4dos to map iso file and use the following code:
title Windows 7\nWindows 7 install
map /seven.iso (hd32)
map --hook
chainloader (hd32)

Here is a link for reference:grub4dos mapping (grub4dos can map so many iso files) 
Windows Vista and Windows 7's imaging utilities (backup) are some of the best i've seen and i highly suggest you use that instead of RuntimeSW DriveImageXML. The imageX utility with Vista and 7 and they have an option for a full image backup with compression. Use it so when things do crash you can boot to the CD and just restore from your full image backup. Its also quicker than DXML. Just try it on the RC you have and see if you like it. Nice thing is with command lines you can keep your backup up to date by applying windows updates to it without ever deploying and recapturing the image
Windows 7 is basically Vista plus SP1 plus SP2
Vista DVD and Windows7 installation DVD are Bootable PE and they are hot plug
which means if you put ghost32.exe and say A43 file manager on a USB memory stick
boot with installation Windos 7 (or Vista) DVD using A43 file manager you can browse to
the USB disk and double click ghost32 and if it is one which came with ghost 14 it should be
Vista compatible.
With UBCD4win you can use drive image XML to image the Disk but it will not be bootable
you need to boot with installation DVD and choose repair option to repair the bootand make it bootable.
Vista and Windows7(son of Vista ) have different booting system they have the boot manager and a
BCD (boot configuration data) store.

Quick and dirty fix for testing.
Be aware: CD boot only.
USB boot may fail.

Use layout
QUOTE
plugin\zz_custom\Win7\Win7RD32.inf
plugin\zz_custom\Win7\files\Win7RD32.iso
plugin\zz_custom\grub4dos\grldr.inf
plugin\zz_custom\grub4dos\files\grldr
plugin\zz_custom\grub4dos\files\menu.lst
Win7RD32.inf
CODE
[Version]
Signature= "$Windows NT$"

[PEBuilder]
Name="!Multiboot: Windows 7 Recovery Disc (x86) - testing"
Enable=1

[WinntDirectories]
a="images",2

[SourceDisksFiles]
\files\Win7RD32.iso=a,Win7RD32.iso,1grldr.inf

CODE
[Version]
Signature= "$Windows NT$"
;grub4dos
;http://nufans.net/grub4dos/

[PEBuilder]
Name="!Multiboot: grub4dos as default loader at CD - testing"
Enable=1

[SourceDisksFiles]
files\grldr=1,BOOTFIX.BIN,1
files\menu.lst=30000,menu.lst,1
menu.lst
CODE
color black/cyan yellow/cyan
default /default
default 0
timeout 10

title Launch "The Ultimate Boot CD for Windows"
ls /I386/SETUPLDR.BIN && chainloader /I386/SETUPLDR.BIN
ls /minint/SETUPLDR.BIN && chainloader /minint/SETUPLDR.BIN
boot

title Launch "Windows™ Recovery Console"
map --mem /CMDC/SETUPLDR.BIN (rd)
#checksum: geitonaki http://www.msfn.org/board/index.php?showtopic=58410
write --offset=0x2060 (rd)+1 \xEB\x1A
#change minint to I386, disable some defaults
cat --locate="i386\\" --replace="CMDC\\" (rd)+1
cat --locate="\\$WIN_NT$.~BT\\" --replace="\\$WIN_NT$.OFF\\" (rd)+1
#cat --locate="\\CMDCONS\\" --replace="\\CMD_OFF\\" (rd)+1
#cat --locate="winnt.sif" --replace="winnt.off" (rd)+1
chainloader (rd)+1
root ()
boot

title Windows 7 Recovery Disc (x86)\nAccess Repair Options For Windows 7 (x86)
map /images/Win7RD32.iso (0xff)
map --hook
chainloader (0xff)

title Darik's Boot And Nuke v2.0 ~ Submenu\nWarning: destroy data
configfile /dban-Grub4dos.ini

title FreeDos
map --mem /images/freedos.img (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)

title GOBACK Removal Tool
map --mem /images/goback.ima (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)

title Memtest86+ v4.10
map --mem /images/memtestp.img (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)

title NTFS-Dos
map --mem /Images/ntfs4dos.img (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)

title boot 1st hdd
chainloader (hd0)+1

title commandline
commandline

title reboot
reboot

title ******* menu end **************
configfile /menu.lst
Go up to "menu end" at cd, ignore following lines.
----------------------------------
[SourceDisksFiles]
files\grldr=1,BOOTFIX.BIN,1 thumbsup.gif
files\menu.lst=30000,menu.lst,1

Sunday, July 4, 2010

BCDEdit.exe -specializing a BCD

Source
(Windows of course also keeps partition and disk information of its own, even prior to Vista.  But in my experience this never resulted in a boot issue for the situation described, and Windows automatically updated and corrected if a different partition / disk signature was used.)
The cause of the Vista load failure previously described, to the degree I understand it, is that by default all of the BCD entries use "PARTITION"-type device references where applicable.  In the BCD data stored for these "PARTITION"-type device references (visible in the BCD section of the registry, and in a BCDEDIT /EXPORT), both the drive signature and the partition number appear to be part of the information stored.  And based on the results, both must match the current environment else the boot manager will declare the OS loading application cannot be found.
(Even if I force the drive signature to be the correct signature, if I'm restoring to a different partition than the image was previously using, the restored partition will still fail to boot because the partition number stored in the BCD still doesn't match the current environment.)
The solution that appears to be most suitable (at least for the situation I previously described and was intending to solve) is to change the BCD entries to use "BOOT" device references rather than explicit "PARTITION"-based references.  Presumably thereby implying "whatever device/partition I booted from, that is the device/partition I want to use".
Preparing a Vista installation prior to creating the Ghost image then becomes a task of setting the DEVICE and OSDEVICE entries of the BCD entries you intend to use:
To run BCDEDIT.EXE, indeed you need to have your full Administrators rights in effect.  You can do this with any Administrators-member account (not specifically "Administrator"), but you will need to right-click the Command Prompt shorcut and select "Run as Administrator" in order to subsequently run BCDEDIT.EXE successfully within that Command Prompt session.
(Or, as alluded to, if UAC is simply disabled altogether that would give you full Administrators right in any Command Prompt session too.  But simply right-clicking the Command Prompt and selecting "Run as Administrator" will suffice for the default UAC-enabled mode of Vista.)
Logon as Administrator and from a command prompt invoke the following changes:
BCDEDIT /set {bootmgr} device boot
BCDEDIT /set {default} device boot
BCDEDIT /set {default} osdevice boot
Note you can "fix" a previously restored (and currently failing to boot) installation using a PE boot disc and executing these same actions against the restored partition's BCD entries.
There may be more entires that you need to fix if you intend to use them ({memtest}, {legacy}, etc.).  The above is just the minimum for my own scenario where there is just a clean Vista-only OS installation on the partition.
Once the BCD entries are no longer referring to specific disk signatures and partition numbers, there is no need to use -FDSP with Ghost anymore, either.  The disk signature can be reset as it is by default with a Ghost disk restore, and "nothing special" is required during image creation or restore (from a Ghost perspective).
Presumably this could have also been corrected by resetting/updating the "PARTITION"-type device entries with current information (current partition number and disk signature) post-Ghost restore, if for any reason the use of "PARTITION"-type references is needed.  For the purposes of making an image that can be restored via Ghost to any partition on my test box, the "BOOT" device reference appears most desirable by not being fixed to any one partition or disk signature.
------------------------------------
I found even ghost 7.5 to work.
just run the following commands from a cmd box in vista under an admin account :
BCDEDIT /set {bootmgr} device boot
BCDEDIT /set {default} device boot
BCDEDIT /set {default} osdevice boot
then make a ghost image as you normally would. (ghost 7.5 doesnt even understand the -fdps switch)
also i got ghostwalker to work (we only use it to change the computer name). ghostwalker looks for msdos.sys & boot.ini, it uses the content of boot.ini to locate windows. tho vista uses bcd instead of those files you can just copy them from windows xp. (havent tried changing the sid tho)
------------------------------------
Vista with ghost 11 works a treat, still havent tried any earlier versions with it though..
Allthough, i get that error "unable to access \windows\winload.exe", so I ran the repair from and vista cd, and it fixed it in almost 5 seconds, re-booted, and problem solved..
-------------------------------------
Follow up - Using the Vista install disk, it has a 'Repair' option that you can access a command promopt with. To get there, do this:
- On the system that won't boot due to the error, put your install disk in, and boot off of it.
- When it asks you for your language, select the language options you want, and then click "Next".
- On the following dialog, there should be an link at the bottom that says "Repair...". Click that.
- A dialog will come up where it will say "Scanning for Windows Installations..", let it finish.
- It *MAY* tell you that it found an installation that is corrupt, and offer to fix and reboot. Select "No", do not fix.
- That dialog will go away and you'll have another with a list of things you can do. Near the bottom will be "Command Prompt". Select that.
- In the command prompt that pops up, type 'bcdedit' and hit enter. It will give you a list of items.
- Note the "designation" part of each section. For each section, set the 'device' and 'osdevice' (if it is listed) to 'boot' for each section you see. For example, on all of my systems, I have two items - a designation of 'bootmgr' with "device" in it, and a section of 'default' with "device" and "osdevice" on it. So, I run the three commands:
bcdedit /set {bootmgr} device boot
bcdedit /set {default} device boot
bcdedit /set {default} osdevice boot
And yes, type the lines exactly like that - unlee you have something else in the "designator" section on output of bcdedit.
- After finished, type 'bcdedit' again, and it'll show your changes.

That's it - if you need to make a ghost image, then reboot and make it there.
------------------------------------------
There is a tool available that will prepare your Vista installation for cloning. 
It can be found at:
http://www.net-runna.com/Agreement/tabid/243/Default.aspx


============================
Source
Possible partition issues - Preparing the BCD.
Fix the BCD while working from another OS or the Vista DVD.
Hibernation issues - Backup the BCD - Whole drive cloning.

logo-7The information on this page also applies to Windows 7 - except where indicated.
Cloning
Vista is similar enough to previous versions of the NT operating system that many current cloning tools can still be used for Vista. The problems arise mostly from the new Vista boot files bootmgr and BCD, the way they use the Disk Signature, and the new Vista partitioning rules. If these factors are taken into account and adjusted for then the majority of pre-Vista tools are perfectly capable of doing the job. Of course many cannot be installed inside Vista, but they can be run from another OS or boot disk. Third party vendors of such tools are releasing Vista compatible versions, but some still have issues that have not been fully addressed.
Cloning any WinNT OS requires adherence to certain rules to get a clean booting and independent clone that is not in some way cross-linked with the parent install. When using the Microsoft bootmanager with its reliance on separate system and boot partitions and non-default drive letters there are extra variables that can make successful cloning more tricky. I have tried to provide some information relevant to the MS bootmanager, but please be aware that the information here is mainly aimed at systems where the Windows installs are independent with all their boot files on their own partition and see themselves as the C: drive and their partition as both system and boot. If you don't know what I mean by 'independent', or you are using the MS bootmanager and don't understand how it operates, then you should read this guide before attempting to multiboot clones.

Off Boundary Partitions
.
The first and most potentially troublesome issue to be aware of is that Vista created partitions are different, so many pre-Vista cloning tools will either just not recognise them as valid partitions, or worse still try and correct what they see as errors. If you have allowed Vista to create its own partition during install, or used any Vista tools such as Disk Management or Diskpart to create or resize any of the partitions on the computer, then you would be advised to be extremely cautious in using a pre-Vista cloning, imaging or partitioning tool. Not all tools will baulk at the Vista partitions and some will clone and image them, but none will keep the structure of the Vista partition for the newly created clone or restored image, (unless you are doing a whole drive sector-by-sector clone, see section below). Powerquest's Drive Image and Partition Magic will not work with Vista partitions and their attempts to 'repair' things will damage Vista. As long as all partitions on the computer are old style then you have at least a fair chance of success, but more importantly you have much less of a chance that you will do any damage. If your cloning tool seems happy working with a Vista OS and goes to work without reporting any errors, then you should be okay.

Winload.exe........Is Missing
.
After successful cloning you will still be unable to boot the clone unless the Vista BCD file is pointing to the correct new location of the Vista bootloader. It's very similar to how the boot.ini file has to be edited to point to the new partition or drive, but unlike the boot.ini you can't just edit the BCD in Notepad. Correcting the BCD in clones is possible and not particularly difficult, but it is more of a hassle than opening Notepad and changing a digit or two. What would be ideal is if the BCD could be made to just point to the winload.exe that was on the same partition as itself. This would allow a new clone to boot without having to make any corrections to the BCD.
Fortunately there is a way to do this and it makes cloning Vista almost easier than any previous NT operating system. Thanks for this edit to the BCD goes to the man who first reported it. It's still not exactly clear what happens in the Vista bootmgr when this edit has been applied, but it has been used by a lot of people since 2006 with no reports of any problems or issues. It is not a published Microsoft fix, but it appears to be exactly the same edit as applied by Microsoft's own sysprep utility. The sysprep tool is designed to allow computer suppliers and IT pros to easily deploy Vista to numerous computers, by letting them install Vista once and then copy it to the other machines. That single install has to be 'generalized' so that when it is rebooted for the first time on another machine it is able to adapt to its new surroundings. My examinations of the 'generalized' BCD of a syspreped Vista install has shown that it employs the same edit as described here. If it's how Microsoft do it, then I think we can be fairly confident that it is a valid approach. If you don't want to generalize a BCD but just reset one to its new surroundings, then see the section below, Re-Specialize a BCD.
...
...
Re-Specialize a BCD
If you want to change a generalized BCD back to a specialized one, or just repair one so that it is specialized for its new surroundings, then it only takes replacing the 'boot' component in the BCDEdit.exe commands with specific partition drive letters. To fully un-generalize a BCD of an independent Vista that you are booted into then you need these five commands, where X is the drive letter that the OS sees itself as. An error from the first two commands here will tell you that there is something wrong with your set-up and you are not working on the BCD or the Object you think you are. But remember that the absence of an error message is not a guarantee that you have got things correct. If you have not yet read the beginning of this page you should do so before proceeding. (The {memdiag} command is only required if you ever want to use the MS boot-time memory tester. The {ntldr} command is optional for Vista and won't apply to Windows 7 unless you actually have a legacy OS installed and you are using the MS bootmanager).
bcdedit /set {current} osdevice partition=X:
bcdedit /set {current} device partition=X:
bcdedit /set {bootmgr} device partition=X

bcdedit /set {memdiag} device partition=X:
bcdedit /set {ntldr} device partition=X:
To specialize a BCD while working from another OS or the DVD your commands will be as follows, where the drive letter of the partition is the same as the drive letter in the path to the BCD. That is both Xs have the same value. (These are also the commands you would use from inside an OS if you were having trouble getting BCDEdit.exe to target the OS's own BCD).
bcdedit /store X:\boot\bcd /set {default} osdevice partition=X:
bcdedit /store X:\boot\bcd /set {default} device partition=X:
bcdedit /store X:\boot\bcd /set {bootmgr} device partition=X:
bcdedit /store X:\boot\bcd /set {memdiag} device partition=X:
bcdedit /store X:\boot\bcd /set {ntldr} device partition=X:
Remember, you are not setting drive letters in the BCD, you are simply telling BCDEdit.exe which partition you mean, in this case you mean the partition the Vista install is on.
(Note - If you have the MS bootmanager configured and operational in the BCD that you are targeting and your Vista install is on a different partition to that BCD then the first two commands above will require the specific GUID for your Vista and not the {default} identifier. The value of the Xs in those two commands will also be different, the store X: being the BCD's partition drive letter and the partition=X: being Vista's partition drive letter).

Manually Set Hibernation Object
If you do have trouble with the resume object correctly resetting or just want to do it yourself then here is the command. First make sure that hibernation is indeed turned on as described at the bottom of this section. There is no shorthand identifier for this one so you have to use the full 32 digit GUID number. Run bcdedit /enum all and the GUID you want is the 'Identifier' for the Resume from Hibernation object. You will almost certainly be doing this from inside the OS you are having trouble with so it will be possible to copy and paste the GUID instead of having to type it out. To copy from the command prompt window right click anywhere and from the popup menu click ‘Mark’ then highlight your text and either right click or press Enter to copy. Or you can click ‘Select All’ and paste everything into Notepad or whatever.
If your BCD is generalized then the command will be:
bcdedit /set {xxxxxxxx-your-guid-here-xxxx-xxxxxxxx} device boot
If the BCD is Specialized then it is this, where X is Vista's own drive letter.
bcdedit /set {xxxxxxxx-your-guid-here-xxxx-xxxxxxxx} device partition=X:
(If you are working from another OS or the DVD then X will be the letter that is currently assigned to the Vista partition).
Once hibernation has been used for the first time a new line (Element) called 'resumeobject' will appear in the bootmgr Object, and also a new one called 'filedevice' in the resume Object. The filedevice Element in the resume Object uses the signature and offset information and so has to be set correctly, but we never have to do this one ourselves because it is reset every time hibernation is used. It is always specialized, so there would be no point in generalizing it.
It is this auto specializing of the filedevice Element just before hibernation shuts the system down that is part of the cause of hibernation or hybrid sleep problems in independent Vistas on second or higher hard drives or logical partitions. If your bootmanager is not fully Vista compatible then the wrong BCD store can be set for resume, see BCD is Always Open. If you do want hibernation to function in independent Vista installs on anything other than boot drive primary partitions, then I have found no solution other than making sure your bootmanager is fully Vista compatible. The new Hybrid Sleep in Vista also uses the hibernation function and so partly suffers from the same problem. Hybrid sleep is hardware dependent so it may not be available as an option on slightly older machines. If you do have it turned on then you will not have hibernation as an option on your shutdown menu. You have to set hybrid sleep to Off before hibernate will be available.

Hibernation and Third-Party Bootmanagers.
Most bootmanagers will happily let you boot to another OS while you still have one in a state of hibernation. This is something the MS bootmanager won’t allow because it can lead to data corruption. If you have a common data partition that is visible to more than one OS, or you just allow OSes to see each other, a hibernated OS may have left open file handles to shared files, which will cause problems for another OS wanting to access those files. It works the other way as well because a newly resumed OS will not be aware of any changes made to shared files since it went into hibernation, the cached file table index resumed to memory will not match the actual file table on disk. Running chkdsk will refresh the index or delete orphaned files. Perhaps this solution for Windows XP Embedded can be adapted for any WinNT operating system. If anyone has explored this then please share - feedback.

Turning Hibernation On and Off
.
By default the hibernation feature should be on and you can check if it is by looking to see if you have the hibernation file hiberfil.sys in the root of your install (it is hidden by default remember). If it's not there then hibernation is off and so the resume object device element will not auto reset itself on bootup. To turn it on at the command line enter powercfg /h on to turn it off powercfg /h off The hiberfil.sys file can show as a couple of gigs in size even when it's not being used, so if you don't use hibernation or hybrid sleep then you can get rid of this file by turning hibernation off.

Backup and Restore a BCD with BCDEdit.exe
If you want to create a backup of a BCD from inside the Vista OS that is holding it open, then the command will be as follows – where X:\folder\ is the target drive and folder where the back-up will be saved to.
bcdedit /export X:\folder\bcd
To restore the BCD from your back-up
bcdedit /import X:\folder\bcd
If for example you create a new folder in the root of the C: partition and call it boot2, then the path would be C:\boot2\. If you want to send the BCD backup to your documents folder on the C: drive then the whole command would be bcdedit /export C:\users\yourname\documents\bcd. If you include any spaces in the folder name or the name you give to the BCD back-up file you have to enclose the path and file name in quotation marks: e.g. bcdedit /export “C:\boot2\bcd bkup”

Whole drive sector-by-sector cloning
If you make a complete sector-by-sector clone of a drive containing Vista then you will duplicate the disk signature and the partition offset and so you will not have to modify the BCD to get Vista booting, because it will already contain the correct information. Be aware however that you cannot have two hard drives on the same computer with identical disk signatures. If you boot any WinNT operating system when there are two drives with the same signature then one of the signatures will be automatically changed. If you do clone a Vista drive in this way and need both drives connected at the same time then generalizing the BCD before cloning, or re-specializing or generalizing the BCD on the affected drive, will fix the problem. This has always been an issue when cloning entire hard drives containing WinNT, but before Vista a signature change could in many cases not cause an issue and so may have went unnoticed.

Cloning Vista for anything other than backup or recovery may violate your EULA