M
Mikoyan
Can anyone tell me what bootsect.bak does?
Mikoyan said:Can anyone tell me what bootsect.bak does?
R. C. White said:Hi, Mikoyan.
The exact function of this file has changed with successive generations of
Windows, so this answer may not be correct for all versions. (Also, I am
not a techie, so, even if my explanation is correct, there probably are
others who can explain it better than I can.)
When the computer is first powered on, it knows nothing. But there is an
EEPROM (Electrically Erasable Programmable Read Only Memory) chip on the
motherboard that holds the Basic Input/Output System (BIOS). These are
the most basic, most primitive instructions that make the system start to
"pull itself up by its bootstraps" - that is, to "boot" itself by starting
from zero. These first instructions can't do much but tell the hardware
to find the first internal hard disk drive, transfer the contents of the
first physical sector on that disk into memory, and then start executing
the instructions found there. This first sector on each HDD is the MBR -
the Master Boot Record. A sector is only 512 bytes long; there is just
enough room to hold the 64-byte Partition Table plus about 400 bytes of
still-primitive instructions. The Partition Table has room for four
16-byte entries; each of these tells where one partition starts and ends,
plus a few bits of information about that partition, including whether it
is the one Active (bootable) partition on that HDD. The MBR code finds
the start of that Active partition and loads the first physical sector of
that partition into RAM and starts executing those instructions. This
first physical sector of the Active partition is the "boot sector". This
partition is the "System Volume" for this boot session; it is often
referred to as the "System Partition" since it must be a primary
partition, not a logical drive in an extended partition.
The contents of the boot sector vary, depending on which operating system
wrote it onto the hard drive. The Win9x boot sector had instructions to
look for the files IO.SYS and MS-DOS.SYS. Win2K/XP boot sectors are based
on Windows NT, so they look for NTLDR, the NT loader. Vista and Windows 7
boot sectors look for bootmgr, the boot manager.
No matter which code is in the boot sector, it must find a file with no
extension in the Root of that Active partition. At this very early boot
stage, the computer doesn't yet know how to deal with extensions or
folders or multiple partitions, much less multiple hard drives. So those
first startup files must be in the Root of that partition and the correct
boot sector code must be on the first physical sector. This sector is
OUTSIDE the file system, so it can't be copied or backed up or otherwise
handled by normal Windows programs or utilities. Only special
system-level utilities, such as Windows Setup, can deal with the boot
sector.
When we install WinXP, Setup writes the XP-style boot sector code, which
will look for NTLDR - which will then find the files NTDETECT.COM and
Boot.ini, also in the root of the System Partition, and use those to find
the file ntoskrnl.exe in the Boot Folder (typically C:\Windows - but not
necessarily) to load WinXP.
But Vista and Win7 write different code into the boot sector. This looks
for the file "bootmgr" - no extension - in the Root of the System
Partition. Bootmgr reads the files in the hidden \Boot folder on that
partition; this folder holds the Boot Configuration Data (BCD) which
Vista/Win7 uses to find the file winload.exe in the Boot Folder (also
often - but not always - C:\Windows, the same filename as for WinXP) and
use that to boot Vista or Win7.
When Vista/Win7 Setup discovers an existing WinXP boot sector in the
System Partition, it saves a copy of that sector in a new file in the Root
of the System Partition; this file is typically C:\bootsect.dos. This is
a part of the process of updating the BCD to provide for a multi-boot
system, which will present an operating system menu at each subsequent
reboot.
Later, at each boot, if the user selects to boot Vista/Win7, bootsect.dos
will be ignored, along with NTLDR, etc. But if the user chooses to boot
an "Earlier version of Windows", then bootmgr will step back out of the
way and load the WinXP-style boot code from bootsect.dos, which will find
NTLDR, etc., and load WinXP. After this initial selection, the computer
will see only WinXP code or only Vista/Win7 code; neither will interfere
with the other.
After all that, I still haven't mentioned bootsect.bak. I have both the
.dos and .bak versions of bootsect in my System Partition. Each is
exactly 512 bytes, one sector, with no apparent differences. I'm not sure
how .bak came to be created, but it is dated later than the .dos file.
Now, let's hope a true techie will fill in the missing links. ;<)
RC
--
R. C. White, CPA
San Marcos, TX
(e-mail address removed)
Microsoft Windows MVP
Windows Live Mail 2009 (14.0.8089.0726) in Win7 Ultimate x64