www.thpc.info TweakHomePC www.thpc.infoDual-booting all versions of Windows and Linux
|Dual-Boot Centre 9x Speed Tweaks How do I ... 9x Updates 9x Utilities Downloads PC Safety Site Map Link|
Boot Sequence in a Windows Dual-Boot ExplainedLast reviewed: May 2005
BIOS begins the Windows bootup sequenceA little understanding of the bootup sequence is a wonderful asset when creating a natural dual-boot, and even more so if a repair ever becomes necessary. This page deals mainly with those parts of the bootup that relate to a Windows-based dual-boot or multi-boot.
This page presumes a third-party boot utility is not involved. Nevertheless, the basic information applies even one is in use.
The BIOS has full control of early bootup of your computer. At the end of its initial activity, the BIOS passes control to code (MBR) which is always on the first sector of a disk (Cylinder 0, Head 0, Sector 1). The MBR looks for a bootable device. This is usually a hard disk but can be a floppy or a bootable CD. A flag (a single bit marker in the Partition Table) on the media identifies it as being Active. The MBR passes control to code in the PBR on the first sector of the Active partition. The PBR code calls the boot files on that (the system) partition into action and those files start Windows from its installation directory. The partition containing the installation directory is known as the boot partition. Sometimes the boot partition and system partition are the same partition (usually C:).
There's a Boot Order in the BIOS:
The BIOS has a Boot Order list, or Boot Sequence list, that it uses to look for the Active partition and it accepts the first bootable device it encounters. The normal boot order is floppy first, then hard disk(s), then CD-ROM, and then others. This is why you may need to change the boot order in the BIOS if you want to boot from a bootable CD - otherwise the CD may never get a chance to boot (read Boot from a bootable CD for details).
If the BIOS finds the first choice is not bootable (Active), it will try the next device in the list. If there are no bootable devices in the list, or if it does not find the correct boot files on a bootable device, then the startup process will halt. If you have ever left a floppy disk in the drive when you restarted your computer, you will have seen the message "Non-System disk or disk error. Remove ..."
[top of page]
Standard Bootup SequenceEvery disk is divided into a large number of sectors (usually 512 bytes). A cluster contains a contiguous number of these sectors. A partition (there's always at least one) contains a number of these clusters. However, a small number of sectors remain 'outside' the partitions and these contain very important information for booting the PC and running the OS.
Each hard disk has a MBR (Master Boot Record) on the first sector of the disk (it's outside any partition). The BIOS always passes control to the MBR on the first bootable disk. The MBR contains (a) the MBR Code that's used to locate the Active partition, and (b) the first part of the Partition Table for the entire disk.
In similar manner, each partition has its own PBR sector (Partition Boot Record) on the first sector of the disk area allocated to that partition. The information in a PBR is specific to that partition only. It contains information on the nature of that partition (name, location, size, number of sectors per cluster, file system, etc).
The partition containing the boot files for the installed OS(s) is special and is called the system partition. It will/must always be marked Active. Also, the PBR for this system partition contains the OS PBR Code (also called OS Boot Sector Code) which is responsible for calling the boot files of the OS to be loaded. This boot code is OS-specific and passes control to only one specific boot file (NTLDR for a NT-type OS, or Io.sys for a Win9x-type OS).
The PBR is commonly called the Boot Sector when it refers to the system partition. Therefore the OS PBR Code is referred to below as the OS Boot Sector Code in order to comply with common usage. Both expressions are interchangeable on this page.
BIOS > MBR (1st sector of disk) > OS Boot Sector Code of system partition (Active) > boot files (system partition) > OS (boot partition)
And Yes! The boot files are on the 'system partition', and the OS's system files are on the 'boot partition'!
[top of page]
Dual-Boot Bootup SequenceMicrosoft designed XP/2K/NT (not Win9x) to be dual-booted or multi-booted with the same, or earlier versions of Windows or MS-DOS (version 5 or later). The most recent Windows installation overwrites the existing MBR. PBR, and boot files (if using same name) with its own versions, so Microsoft says the oldest version of Windows must be installed first. However, this restriction can be overcome and you can install an earlier version on a computer containing a later version, creating a dual-boot - see Dual-Boot Centre below.
When looking for an Active partition, the Microsoft version of the MBR limits its search to just four Primary partitions and does not search for an Active partition in the Logical partitions. This means the partition marked Active must be a Primary partition and it must also be on the Primary Master disk. Thus the system partition, containing the boot files, cannot be on a second hard disk. A boot partition (where OS main files reside) can be any Primary or Logical partition on any hard disk (but some OSs and BIOSs do have a size limitation).
Dual-boot (NT or higher + Win9x or higher and/or + Linux)
(It starts outside all partitions and is not OS-specific)• In (c) above: The system partition contains all boot files for every installed Windows.
The system partition may also contain a Bootsect file for an OS other than XP/2K/NT,
and will also contain \Cmdcons\Bootsect.dat if the Recovery Console is installed.
• A natural dual-boot executes in line (c). A boot file points to the directory of the selected Windows.
There's just one Active partition. All installed OSs use the same OS Boot Sector Code, initially at least.
• A dual-boot created with a third-party boot utility usually executes in line (b) using its own non-Microsoft MBR. Boot managers typically hide all active Primary partitions of any hard disk, with the exception of the active partition selected for booting.
The two most critical parts are the OS Boot Sector Code on the system partition (Active) and the boot files on that partition. Both should reflect the latest version of Windows (not the most recently installed Windows if that's an older version). This is easiest to achieve if the latest version is installed last (the dual-boot is created automatically), but there are other methods that achieve the same result (and without data loss!) - see Dual-Boot Centre below.
Much of the above will be new to many readers. If so, it's recommended that you read, and reread it. It's not difficult, it's just new! It will all fall into place and you will then fully understand ALL dual-booting mechanisms.
Some users may feel a third-party boot utility will resolve all problems. However, they'll still need to know most of the above. Also, if a problem develops when using a third-party boot utility, another level of repair is necessary and that repair is not always successful. Repairing a 'natural' dual-boot is relatively easy and usually successful.
[top of page]
Remember!Active Partition: You must have one! It can be verified or created by booting from a Win9x boot disk, typing Fdisk, and selecting option 2. It must be a Primary partition on the Primary Master (1st disk).
System Partition: It's the Active partition with the same rules as the Active! It must contain all boot files for all OSs installed. It's nearly always the first partition (C:). There can be only one system partition. It's also often the boot partition for one of the installed OSs - when C: is the system partition and one OS is installed on C:
NTFS Partition: Win9x ignores an NTFS partition. If Win9x is part of the dual-boot and the first partition uses NTFS, then the first FAT/32 partition must be the system partition. The first FAT/32 may be the second partition and still allocated the C letter under Win9x, but will be allocated a different letter under an XP/2K/NT using NTFS.
Boot Partition: Different OS versions should never be installed on the same (boot) partition. Therefore there will be more than one boot partition. Each one contains the OS's installation directory, folders & files, Program Files. It can be a Primary or Logical partition, and can be anywhere on any hard disk provided there are no BIOS (INT13 Extensions), file system (FAT), or OS (Win95) restrictions.
Boot Files: Boot files are initiated by the OS Boot Sector Code. They are used to set certain parameters and to identify the location of the OS to be used. Windows XP/2K/NT use different boot file names than Win9x, so they can never be misidentified. The NTLDR and Ntdetect.com on the system partition must be from the latest version of XP/2K/NT installed. Boot.ini is a 'text' file and will not cause a version conflict (though its contents are still vital).
XP/2K/NT Boot Files: Ntdetect.com, NTLDR, Boot.ini, and sometimes Ntbootdd.sys. Win 2K also uses Arcldr.exe & Arcsetup.exe
Win9x Boot Files: Io.sys, Msdos.sys, Command.com, and usually Config.sys and Autoexec.bat
Bootsect.xxx: It's an image of the OS Boot Sector Code for an OS other than XP/2K/NT. It's on the system partition (read below).
[top of page]
Rescue Boot Disk:The system partition (Active partition) can be on a floppy boot disk (or bootable CD). This means a Rescue Boot Disk can replace the system partition and the boot files. It will boot, or multi-boot, your Windows even if there's a fault with the hard disk's MBR, the OS Boot Sector or its code, or any of the boot files (they are all on the floppy!). A Rescue Boot Disk is a 'must-have' for all dual-booters (create it when a dual-boot is working fine). The OS files from the boot partition can't be on a floppy (unless they're very small, like MS-DOS).
[top of page]
About the PBR and its OS Boot Sector CodeA PBR, on a partition's first sector, contains a Parameter Block (or Table) and some boot code.
The Parameter Block defines the characteristics of the partition (size, sectors, file system, name, etc).
The PBR is written to whenever that partition is formatted.
The Format command can, for instance, alter the file system of the partition (FAT, FAT32, NTFS, others).
The boot code in the partition marked Active is the OS Boot Sector Code, and is created by Format.
The OS Boot Sector Code can also be recreated by using certain commands (see Sys, and Fixboot, below).
Also, an existing OS Boot Sector Code will be overwritten by one for a new OS installation.
In a 'natural' dual-boot, there's only one OS Boot Sector Code and all installed OSs use it, at least initially.
The OS Boot Sector Code is specific to the Windows-type that Formats it (NT-type or Win9x-type).
The OS Boot Sector Code for XP/2K/NT is therefore different from the code for Win9x.
The OS Boot Sector Code for XP/2K/NT
This OS Boot Sector Code can be used by XP, 2K, or NT. It passes control to the boot file NTLDR (& Ntdetect.com) which is OS-specific. This code can be recreated with the Fixboot command run from the Recovery Console (on the CD).
The XP/2K/NT Boot Sector Code can, indirectly, be made to boot a Win9x provided two special conditions are met. These are (a) the existence of a valid C:\Bootsect.dos (an image of the Win9x Boot Sector), and (b) the inclusion of the line C:\="description here" in the [operating systems] section of Boot.ini
The OS Boot Sector Code for Win9x
The Win9x Boot Sector Code can be used by any version of Win9x or by version 5+ of MS-DOS. It passes control to the Win9x boot file IO.SYS (& Msdos.sys) which is OS-specific. This code can be recreated with the SYS C: command from the Win9x boot disk.
The Win9x boot code can never be used to boot an XP/2K/NT. However, the Win9x boot code can be saved (to Bootsect.dos) and used later after an XP/2K/NT has been installed or after the XP/2K/NT Boot Sector Code has been restored with the Fixboot command.
[top of page]
About the Bootsect File and Boot.iniC:\="(description)" in the [operating systems] section of Boot.ini
The Bootsect file (512 bytes) contains an image/copy of the PBR (OS Boot Sector) for an OS other than XP/2K/NT. When the user selects this option from the Boot Loader Menu, NTLDR loads the Bootsect file into memory and uses its OS Boot Sector Code, instead of the original XP/2K/NT boot code, to boot the associated OS. That's how you can use a Win9x, the Recovery Console, or even a Linux on a PC with XP/2K/NT installed - and do it the natural way!
The default is Bootsect.dos because originally Microsoft developed NT to be dual-booted with the earlier Win9xs and they are DOS-based. NTLDR will automatically use C:\Bootsect.dos if you use any of these in the [operating systems] section of Boot.ini: C:\, or C:\bootsect.dos, or C:\="description here" like C:\="Windows 9x"
If you save the PBR (OS Boot Sector) of another OS (like Linux) to a file, you must supply Boot.ini with the full pathway and file name, like C:\bootsect.lnx="Linux". NTLDR will then use that OS Boot Sector Code and load/run that OS. Note that if you dual-boot Linux in the 'natural' way, you must not allow its installation to write its own MBR or to use the Grub or Lilo boot managers.
There can be multiple Bootsect lines in Boot.ini. Each must have a different file extension.
C:\cmdcons\bootsect.dat (if the Recovery Console is installed)
NTLDR converts the pathway to the ARC format before using it. For example:
C:\Bootsect.dos will become multi(0)disk(0)rdisk(0)partition(1)\bootsect.dos
[top of page]
Basic XP Boot Sequence (not dual-booted)• XP Boot Sector Code > NTLDR (& Ntdetect) > NTLDR reads ARC pathway to XP in Boot.ini > NTLDR runs XP from that location.
There's only one legitimate OS here, so no Boot Loader Menu is shown and there's no delay.
The XP/2K/NT pathways shown in Boot.ini use the ARC naming convention. This allows compatibility with RISC computers.
Open C:\Boot.ini (it's a Hidden file) in Notepad. You'll see a line containing the XP partition & directory.
where rdisk(0) is the first hard disk (rdisk(1) would be a second disk), and
where partition(2) is second partition on that disk, and
where WINDOWS is the name of XP's installation directory.
(disks start counting from 0, partitions start counting from 1)
The 'normal' equivalent of this is D:\Windows where D: is the second partition on the first hard disk.
NTLDR uses this information to run XP's initialisation files in the XP directory at that location.
Basic Win9x Boot Sequence (not dual-booted)• Win9x Boot Sector Code > Io.sys > Io.sys reads pathway to Win9x in Msdos.sys > Io.sys runs Win9x from that location.
Open C:\Msdos.sys (it's a Hidden file) in Notepad. You'll see that WinDir and other lines point to the Win9x partition & directory. This information is used by Io.sys to run Win9x from that location.
XP + Win9x Boot Sequence (Dual-Booted)Remember that in the creation of an XP + Win9x dual-boot, the Win9x Boot Sector (OS PBR) is copied to C:\Bootsect.dos while a Win9x Boot Sector exists i.e. Win9x is the most recently installed OS, or the Sys C: command was just run from a Win9x Startup or Boot Disk. The sector is specific to each computer so it can not be copied from another computer.
The Win9x Boot Sector is then overwritten with an XP Boot Sector by installing XP, or by using the Fixboot command. Either will destroy the original Win9x Boot Sector but not its copy in Bootsect.dos.
All installed OSs use the XP/2K/NT Boot Sector, at least initially.
The XP boot sequence for this dual-boot
This will be the same as above (except you can select XP from the Boot Loader Menu options).
• XP Boot Sector Code > NTLDR (& Ntdetect) > NTLDR reads Boot.ini > NTLDR shows Menu (select XP) > NTLDR reads ARC pathway to XP in Boot.ini > NTLDR runs XP from that location.
The Win9x boot sequence for this dual-boot
• XP Boot Sector Code > NTLDR (& Ntdetect) > NTLDR reads Boot.ini > NTLDR shows Menu (select Win9x) > NTLDR loads C:\Bootsect.dos > Win9x Boot Sector Code > Io.sys > Io.sys reads pathway to Win9x in Msdos.sys > Io.sys runs Win9x from that location.
Let's split that into two sections, the XP part and the Win9x part.
• XP Boot Sector Code > NTLDR (& Ntdetect) > NTLDR reads Boot.ini > NTLDR shows Menu (select Win9x) > NTLDR loads C:\Bootsect.dos
• > Win9x Boot Sector Code > Io.sys > Io.sys reads pathway to Win9x in Msdos.sys > Io.sys runs Win9x from that location.
You can see that XP is in control until Bootsect.dos is loaded. Then the Win9x Boot Sector Code is given control and the boot continues as if Win9x were the only OS installed.
The selection of Win9x from the boot menu triggers NTLDR to look for a legitimate Bootsect.dos file on C:. If found, NTLDR loads the Win9x Boot Sector (from Bootsect.dos) into memory and uses that instead of the XP sector. If not found, NTLDR will use the remaining legitimate OS or will fault depending on circumstances.
Booting to Win9x in an XP + Win9x dual-boot is dependent on two main factors:
1. The [operating systems] section of Boot.ini must contain the line C:\="(description)"
2. A valid C:\Bootsect.dos must exist.
XP + XP/2K/NT Boot Sequence (Dual-Booted)• XP Boot Sector Code > NTLDR (& Ntdetect) > NTLDR reads Boot.ini > NTLDR shows Menu (select an OS) > NTLDR reads ARC pathway to selected OS in Boot.ini > NTLDR runs the OS from that location.
[top of page]
Sys C: Command Rewrites the OS Boot Sector (PBR) for Win9xThe A:\SYS C: command should be run from a DOS prompt after booting from the Win9x boot disk created by the installed Win9x. Use this command only if you are sure it's required. Sys makes the computer bootable to a Win9x (provided the relative partition is also marked Active!).
Sys writes a Win9x Boot Sector (OS PBR) to the specified partition overwriting the existing OS Boot Sector. In practice, the specified partition will always be the C: drive. This overwriting of an existing sector is very convenient for a dual-booter who wishes to (re)create a Bootsect.dos file (image of Win9x Boot Sector). Sys C: is run, the new Win9x sector is save to Bootsect.dos, and then the Fixboot command is used to restore an XP/2K/NT sector (read Bootsect.dos created new for details).
Sys also copies files to C:. These are the Win9x startup system files, Io.sys and Msdos.sys, and also the command interpreter Command.com. The Msdos.sys file will not be copied if one exists on C:. These file are OS-specific so you must use a boot floppy created by the installed Win9x. A work-around is to first backup the three files from C:, then use Sys from any Win9x boot disk, and finally copy the backups back to C: - all will be well.
A word of caution.
If C: does not initially contain a Msdos.sys file, then Sys will copy that file from the boot disk over to C:. The Msdos.sys on the floppy is nearly empty and will not boot your Win9x. In the context of creating/repairing a dual-boot, don't use the Sys command unless the C: drive already contains a legitimate Msdos.sys file or you will be wasting your time!
You'll see a 'System transferred' message when Sys has created the OS Boot Sector and copied the files.
[top of page]
Fixboot Command Rewrites the OS Boot Sector for XP/2KThe Fixboot command is run from the Recovery Console after booting from the CD, or perhaps the Recovery Console is installed and is a boot option in the Boot Loader Menu.
Fixboot is used to write a new OS Boot Sector for XP/2K.
By default Fixboot writes a new OS Boot Sector to the system partition.
If you specify a partition, like Fixboot C:, it writes a new OS Boot Sector to the partition nominated by you. This replaces the default drive, which is the system partition you are logged on to.
It's sometimes necessary to specify the partition when creating, or repairing, a dual-boot. If doing this, it is best to play safe and first use the MAP command in the Recovery Console to accurately identify the drive letter allocated to the partition you want to be the system partition. Type in MAP at the prompt and press [Enter]. Check its partition number (first is 1) and its size. Then you can use the DIR command to confirm it by its contents. Type in DIR C: (or DIR D:, etc) at the prompt, and press [Enter].
This can be necessary because the drive letter allocation as shown in the Recovery Console is not always the same as that shown under XP. Typically this may occur if you Format during an XP installation and do not then reboot before continuing the installation (there's no prompt!). It usually is the same, but you need to check. The drive letter shown in the Console is the one that must be used - so be safe, and do check.
Caution: If changing the system partition, you must remember that all boot files for all installed OSs must reside on the 'new' system partition.
XP/2K: To Repair a damaged, or incorrect, XP/2K Boot Sector (PBR):
1. Make the CD-ROM, or floppy drive, the first choice in the Boot Order in the BIOS.
2. Cold boot from the XP/2K CD or the installation disks.
3. Press any key, when asked, to boot from CD.
4. Press R for the Recovery Console (and then C if using 2K).
5. Type in - and then press [Enter]
MAP (optional - see above)
FIXBOOT (or Fixboot C: - see above)
6. Reboot. Rectify BIOS's Boot Order. Test.
Remember you must sometimes specify the system partition with Fixboot.
NT: To Repair a damaged, or incorrect, NT Boot Sector (PBR):
1. Make the CD-ROM, or floppy drive, the first choice in the Boot Order in the BIOS.
2. Cold boot from the NT CD or Setup Disk 1 (and then Disk 2).
3. Press any key, if asked, to boot from CD. Press [Enter] to begin.
4. Press R for Repair when the Setup options appear.
5. Select only the option "Inspect boot Sector" - deselect any other options.
6. Insert a ERD for this Windows when requested,
or press Esc to let repair look for the repair information.
7. Reboot when finished. Rectify BIOS's first Boot Order. Test.
ERD: Emergency Repair Disk:
If you are prompted to insert a ERD made by this Windows and you do not have it, then the repair looks in Boot.ini for the boot path to the repair information on your computer. A failed repair may indicate the boot path in Boot.ini is incorrect. If necessary, edit Boot.ini correcting the boot path, or use bootcfg /rebuild from the Console to rebuild Boot.ini. Then run the repair again.
[top of page]
* ALWAYS BACKUP FIRST * ALWAYS RECORD SETTINGS * ALWAYS MAKE ONE CHANGE AT A TIME
www.thpc.info was formally TweakHomePC at www.tweakhomepc.virtualave.net
Copyright © LarryM 1998-2009 email@example.com