Dual Boot for Windows XP and Windows PE 2.0

Source: Internet
Author: User
In the previous "desktop files", I mentioned that Windows PE has become a recovery tool and introduced how to use it from another partition. Someone asked me a question recently, which makes it necessary for me to discuss the latest development trend of this topic-using both Windows PE 2.0 and Windows XP,
After all, many users may have been using Windows XP for some time, and Windows PE 2.0 is a version that Microsoft will continue to provide support (note that Windows PE 1.x will not be further updated ).
An important difference between Windows PE 1.x and 2.x is that Windows PE 2.x can be guided through the standard boot interface, while Windows PE 1.x must use a unique boot method. Although Windows PE 1.x or 2.xcan be booted from another partition, it may be much easier to boot from the boot partition where the operating system is located (I will introduce it later ).

Dual Boot for Windows
Windows NT has always had poor support for Dual Boot. However, since computers based on the extensible firmware interface (EFI) gradually begin to replace the old ibm pc at bios, Microsoft has changed the Windows boot mechanism, to better work with EFI and adopt the same boot mechanism across all architectures. Since Windows Vista, Windows has adopted a new boot mechanism called boot configuration database or BCD (see microsoft.com/whdc/system/platform/firmware/bcd.mspx ). However, whether it is using the original boot. ini or the new BCD mechanism, Windows can usually guide other operating systems, although this will forward the boot process to other boot loaders.
Before you begin, make it clear that Windows PE 2.0 can only run on systems that are fully compatible with advanced configurations and power interfaces (ACPI) and have at least 384 MB of memory (preferably 512 MB. As I mentioned in the May column (technetmagazine.com/issues/2007/05/?topfiles), non-ACPI systems will not be able to guide Windows PE 2.0, and since Windows PE 2.0 must be directed to RAMDisk, therefore, it requires sufficient RAM to store RAMDisk, any temporary storage space, and all RAM work sets. If your system RAM is less than 384 MB, please give up this approach and switch to Windows PE 1.6. Even experts who are good at slimming Windows PE cannot run smoothly in 256 MB memory.

By the way, don't forget the problem to be solved.
Now, let's take a look at the issues that can be solved by Booting Windows PE 2.0 from the same partition as Windows XP.
Full system recovery is one of the tasks that can be achieved by Booting Windows PE from the partition where Windows XP is located. Because Windows PE 2.0 (the same as Windows PE 1.6) can be fully booted to RAMDisk, you can re-image the entire disk-or use ImageX to separately restore Windows XP files, you do not have to re-image the entire partition.
Because you are allowed to boot to Windows PE at startup, you can even remotely recover the system. Images can be from secondary partitions, shared networks (if not mobile users), restored to a DVD or USB hard disk. If ImageX is used, you can even store it in the partition to be restored. This disk recovery method is a good solution for many problems (except physical disk damage. But it is obvious that it is not suitable for restoring user data unless the initially protected data is restored as part of the Restoration. Remember to use the roaming configuration file and back up data in the PC to prevent data loss in this case. It should also be ensured that any recovery mechanisms used take into account user needs and reduce any potential data loss risks (including loss caused by resetting EFS encryption keys ).
File recovery Windows PE also provides a mechanism to start and run the system (even if the main installation of Windows cannot boot ). In this case, user data can be booted and restored to another system (the user must have a hot backup system) or other locations so that the user can quickly start working again.
Finally, after Booting Windows PE on the Windows XP partition, you can repair the system by running a set of troubleshooting scripts or a simple, user-driven repair or recovery application. This process is similar to a full system recovery, but it involves a small scope and does not compromise user data.
Now we understand the functions that can be implemented by guiding Windows PE on Windows XP partitions. Next, let's take a look at the background to apply this process to any solution we need.

Before Windows Vista
Before the appearance of Windows Vista, the following describes how to boot a system based on BIOS/Master Boot Record (MBR. The BIOS points to the boot device (for the hard disk, it points to the MBR of the disk ). MBR executes code that specifies the partition to be guided. Note that it is the first partition with active tags configured. In the earliest versions of diskpart, partitions cannot be set as inactive (that is, they cannot be removed ). Add a switch in diskpart to solve this problem-otherwise, it will be the first partition with active tags in the Partition Table order. This partition contains the boot sector-it indicates the code to be executed next. From Windows NT to Windows Server 2003, the code to be run is located in a file named ntldr without an extension. If the disk is formatted But Windows is not installed, the error message "NTLDR not found" is displayed when you try to boot ".
You may be interested to know that ntldr is completely backward compatible without forward compatibility. This indicates that ntldr of Windows XP can guide Windows 2000, but not vice versa. This is the reason why the old operating system must be installed before dual-boot is implemented. This is especially important because ntldr does not have a version number.
Ntldr is a real-mode (16-bit) application that starts NTDetect.com, it performs basic device detection and then starts the kernel ntoskrnl.exe (this may be one of multiple files-always renamed as ntoskrnl.exe ). The kernel is a key component in the Windows boot process.
The summary of this pilot process is a bit simple. I omit the entire Win32 initialization process because it is irrelevant to this discussion. To learn more about this boot process, read Windows Internals, Fourth Edition (Windows kernel, version 4) (Microsoft Press, 2004 ).
In addition, note that during boot from the CD, Windows Setup and Windows PE run setupldr. bin instead of ntldr. The actual Boot Code in this file is slightly different, so that it can be booted from the CD (ntldr is not ). This is why setupldr. bin must be renamed as ntldr and put on disk when Windows PE 1.x is booted. This is also why the file cannot subsequently load the boot. ini file (because setupldr. bin is only used for CD boot, boot. ini is not a required file ).

Windows Vista and later
Windows Vista has changed many aspects of this process. Windows Server 2008 has made further changes to it, including allowing IA32 (32-bit supported) to boot from EFI (so far, this boot has not been possible except for Itanium-based systems ). For BIOS-based systems, most of the initial steps of the boot process remain unchanged. The key difference is that BOOTMGR is the boot loader. perform the following steps after initialization.
It searches for the BCD file in the boot directory (actually its own registry Configuration unit ). BCD contains the boot entries to be guided (including the default entries ). See Figure 1 for the image type (executable file type) and Figure 2 for the specific application type to be started. Ntldr can reference one or more such entries. However, only one entry can actually reference the well-known GUID used to load ntldr (see the fifth line in Figure 3 ). Bootmgr then decides the entries to be loaded next, depends on whether the boot system is being booted, whether the system is sleeping, or whether you want to boot to ntldr or another boot Manager (in this case, it points to another boot sector and starts the loader ). This is the most common case when using a non-Windows operating system for Dual Boot. You can find more information on the following websites: microsoft.com/whdc/system/platform/firmware/bcd.mspx.
Figure 3 standard application object

BCDEdit ID GUID
Windows Boot manager {bootmgr} 9dea862c-5cdd-4e70-acc1-f32b344d4795
Firmware Boot manager {fwbootmgr} a5a30fa2-3d06-4e9f-b5f4-a01df9d1fcba
Windows Memory tester {memdiag} b2721d73-1db4-4c62-bf78-c548a880142d
Windows Recovery application without alias 147aa509-0358-4473-b83b-d950dda00615
Traditional Windows loader {ntldr} 466f5a88-0af2-4f76-9038-095b170dc21c
Current boot entry {current} fa926493-6f1c-4193-a414-58f0b2456d1e
The default boot entry {default} does not have a pre-defined GUID.

Figure 2 Application Type

Description
The firmware Boot manager 0x1 is only applicable to the EFI system.
Windows boot Manager 0x2 controls the boot stream. In the Dual Boot system, the boot selection menu is displayed to the user.
The Windows boot loader 0x3 loads a specific version or configuration of Windows.
Windows Recovery application 0x4 restores Windows to its running state when the computer recovers from its sleep state.
Windows Memory tester 0x5 memory diagnostic application.
Ntldr 0x6 is only applicable to PC/at bios systems. Load Windows Versions earlier than Windows Vista.
Boot Sector 0x8 16-bit real-mode application. Applicable only to PC/at bios systems. It can be used to restart the boot process and load non-Windows operating systems.

Figure 1 Image Type

Description
Firmware application 0x1
Bootstrap application 0x2
Ntldr-based loader object 0x3
Real-Mode Applications 0x4

You will notice that the improved Windows Vista boot infrastructure is more rational than previous versions-All boot Code except bootmgr is in the root-Level \ boot directory, after BCD is specified, it can also be transferred to a Windows-specific binary file.

Boot Windows XP and Windows PE 2.0
Now let's take a look at how to use the Windows Vista Boot manager and use Windows PE as an intermediary while continuing to guide earlier Windows XP or Windows versions, add Windows PE 2.0 to the integrated recovery tool group.
Of course, you also need to add another step that Microsoft designed in advance to the boot process. Because the new bootmgr infrastructure needs to be backward compatible with existing ntldr and other third-party boot managers, bootmgr is specially built to support such solutions.
Therefore, after studying the Windows Startup Mode and the new BCD working mode, how can we associate the two and Apply Windows PE 2.0 to the existing Windows XP installation? There are two ways to write down the Boot Sector of Windows Vista (to inform the System of the boot code for bootmgr ). One of the methods is to use diskpart to create and format a new partition through Windows PE 2.0. However, you cannot select this method because you have installed Windows XP and do not want to damage or move it. Therefore, use the following procedure:
Make sure that copies of bootsect.exe and bcdedit.exe are available on the Windows PE 2.0 boot disc (both can be found on the Windows Vista installation DVD ).
Boot Windows XP to the Windows PE 2.0 CD.
After booting, run the following command:
Copy code
Bootsect.exe/NT60 ALL

This sets the boot sector to a boot sector compatible with Windows Vista and knows how to start bootmgr.
4. Copy the Boot manager to the hard disk:
Copy code
Xcopy bootmgr c: \ BOOTMGR/I

5. Copy the boot. SDI file to the \ BOOT directory on the hard disk. You must make a copy before the boot, because the file is locked during Windows PE running, and thus cannot be copied:
Copy code
Xcopy BOOT. sdi c: \ BOOT \

The Source Path is changed accordingly.
6. Copy boot. WIM to the hard disk. Like SDI, a secondary copy should be prepared; otherwise, you will not be able to copy the running file:
Copy code
Xcopy BOOT. wim c: \ BOOT. WIM

The Source Path is changed accordingly.
7. Now create a new BCD storage:
Copy code
Bcdedit/createstore

8. Create a BCD entry to load Windows PE:
Copy code
Bcdedit/create {ramdiskoptions}/d
"Boot Windows PE"
Bcdedit/set {ramdiskoptions}
Ramdisksdidevice partition = c:
Bcdedit/set {ramdiskoptions}
Ramdisksdipath \ boot. sdi
Bcdedit/create/d "Windows PE "/
Application
OSLOADER

9. The GUID is returned for the last row. Replace {YOURGUID} with the actual GUID returned }. They are RAMDisk entries used to Boot Windows PE from the hard disk (4 ).
Figure 4 RAMDisk entry, Boot Windows PE from hard disk
Copy code
Bcdedit/set {YOURGUID} device ramdisk = [c:] \ boot. wim, {ramdiskoptions}
Bcdedit/set {YOURGUID} path \ windows \ system32 \ winload.exe
Bcdedit/{YOURGUID} osdeviceramdisk = [c:] \ boot. wim, {ramdiskoptions}
Bcdedit/set {YOURGUID} systemroot \ windows
Bcdedit/set {YOURGUID} winpe yes
Bcdedit/set {YOURGUID} detecthal yes

10. Now, create a bootmgr entry to start the Boot manager:
Copy code
Bcdedit/create {bootmgr}/d
"Boot Manager"
Bcdedit/set {bootmgr} device boot

11. Finally, set BCD entries for existing Windows installations (change the displayed text in Windows XP to any text you want to display in the Boot manager boot menu ). The last command also sets it as the first (default) entry in the boot menu:
Copy code
Bcdedit/create {ntldr}/d "Windows XP"
Bcdedit/set {ntldr} device partition = C:
Bcdedit/set {ntldr} path \ ntldr
Bcdedit/displayorder {ntldr}/addfirst

12. Now, by selecting the appropriate boot menu entry, You can restart the system and enable it to start the previously installed Windows or Windows PE 2.0. Figure 5 shows the sample output of bcdedit/enum all. This command will list all entries (from Windows PE 1.6) after adding entries to BCD ).

Sample input (click the image to get a larger view)
I have been using a script to automatically execute this task. Currently, it can only copy the boot file to the hard disk and set BCD entries. You cannot set the Boot Sector to the value of Windows Server 2008 while running Windows-it must be executed offline in Windows PE. You can find this script in the Code download section of the TechNet magazine website at technetmagazine.com. To run this script, the following items must exist in the directory where VBScript is run:
BCDEdit
BOOTMGR
\ BOOT \ directory (from Windows Vista or Windows PE 2.0 media)
\ SOURCES \ directory, which contains valid and bootable Windows PE 2.0 BOOT. WIM files
It creates BCD and copies the corresponding boot file. Boot to Windows PE and run bootsect to perform dual boot.

Undo Dual Boot
It is much easier to undo Dual Boot than to implement Dual Boot. Run the following command to restore the Boot Sector to the previous Windows Vista Boot Sector:
Copy code
Bootsect.exe/NT52 ALL

After restoration, you can delete the bootmgr and \ boot directories. At the next restart, the boot sector will be forced to start ntldr, and the Windows PE 2.0 and all Windows Vista boot binaries will be completely removed from the boot stream.

Http://technet.microsoft.com/zh-cn/magazine/cc194422.aspx

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.