Hack 71 Fix the Windows Boot Selector

 < Day Day Up > 

figs/moderate.gif figs/hack71.gif

If a Windows boot.ini file gets corrupted, you might find yourself unable to boot back into Windows. While the Windows Recovery CD can restore a default boot file, unlike Knoppix, it won't let you edit it directly .

Back in the old days of Windows, you could change many different startup settings by editing .ini files that were in the root of your hard drive. Over the years , Microsoft has moved most of the settings that control configuration to the registry, but there is one important file that remains, boot.ini . In this file, you can find information that the Windows boot loader uses to determine booting options and, in the case of more than one Windows OS on a system, which OS to boot. For example, this is a boot.ini file that allows you to boot between Windows 2000 and Windows XP Professional:

 [boot loader] timeout=30 default=multi(0)disk(0)rdisk(0)partition(1)\WINNT [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows 2000" /fastdetect multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Windows XP Professional"  /fastdetect 

This file is split into two parts : the part that contains settings for the boot loader that starts with [boot loader] and the part that containing the different operating systems available for booting that starts with [operating systems] . The first option, timeout , controls how many seconds the boot loader waits before booting the default operating system. The default option tells the boot loader which operating system to boot if the timeout has passed.

In and below the default option for each operating system, notice the syntax that looks like multi(0)disk(0)rdisk(0)partition(1) . This syntax describes which partition the operating system is on. Each section of that partition description has a special meaning, regarding which IDE adapter the partition is on, which disk is on that adapter, etc., but the section that is probably of most interest is rdisk(0)partition(1) . The rdisk(0) section denotes which disk on an adapter to boot from numbered from 0, and partition(1) lists which partition on the drive to boot from numbered from 1.

In the example, the second section of the operating systems line tells the boot loader where to find the Windows system files on that partition. Typically, this is either the WINNT or WINDOWS directory. The next part of the line (in quotes) controls which text the user sees in the boot loader menu. You can change this setting to label the operating system of your choice. As an example, assume that you have a system like the boot.ini describes: a Windows 2000 installation on the first partition of an IDE drive and Windows XP Professional installed on the second partition. You can resize the Windows 2000 partition and create a second partition from the empty space from within Knoppix, which makes Windows XP Professional the third partition. After you resize, change your settings to boot into Windows XP by default. Either use a tool like bootcfg and boot into Windows 2000, or edit the boot.ini with Notepad. Instead of rebooting, you can mount the new Windows 2000 partition read/write, click on the drive icon on the desktop to open it, then right-click on the icon and select Actions Change Read/Write Mode. If the partition is NTFS, follow the steps in [Hack #73] . Next, open up the boot.ini file with a text editor from Knoppix, and change it to the following:

 [boot loader] timeout=30 default=multi(0)disk(0)rdisk(0)partition(3)\WINDOWS [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows 2000" /fastdetect multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="Windows XP Professional"  /fastdetect 

You have changed the partition information for the XP boot to read partition(3) . Now when you reboot, the system loads Windows XP by default.

You can also use this ability to create a boot.ini file from scratch in case your file was has been corrupted and the Windows Recovery CD is nowhere in sight. Here is a sample boot.ini file that should work for most default single-OS Windows installations. This sample assumes that you have installed Windows on the first partition on the first IDE drive (the default for most home desktops) and that all of the system files are located in the WINDOWS directory on that partition.

 [boot loader] timeout=30 default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Boot Windows" /fastdetect 

Enter this configuration into a blank boot.ini file, and when you reboot, you should find that the boot selector is back with your default Windows settings.

 < Day Day Up > 

Knoppix Hacks. 100 Tips and Tricks
Knoppix Hacks. 100 Tips and Tricks
Year: 2004
Pages: 166

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net