six demon bag

Wind, fire, all that kind of thing!

2005-02-27

Multiboot

Dual-booting Windows 9x and Windows 2000
(Windows 2000 installed first)

Let's say you would like to install Windows 9x and Windows 2000 on the same computer and make the system dual-boot. What would be the right order to install the operating systems?

Microsoft suggests to install Windows 9x first and Windows 2000 afterwards. Although this is the easy way I suggest not to do so. The procedure will install the bootloader on the Windows 9x partition where it cannot be protected by NTFS ACLs (the FAT filesystems do not support permissions). Maybe you have heard that installing Windows 9x first was the only possibility to dual-boot Windows 9x and 2000. Rest assured that's nothing but an urban legend. It is possible, although not as simple as the other way.


This can be done because the NT bootloader (ntldr) is capable of starting other operating systems by executing their boot code from a file. All you need is the bootsector of the other operating system's boot partition exported into a file and made accessible to ntldr.

Here's how to do it:

  1. First install Windows 2000 (be sure to leave some empty space on your harddisk).
  2. Run a partition editor of your choice (or even fdisk, if you must) and hide the Windows 2000 partition.
  3. Reboot.
  4. Install Windows 9x into the remaining space.
  5. Reboot again (only Windows 9x will be available at this point).
  6. Now write the bootsector to a file (you may as well skip this step and catch up on it from within Windows 2000).

    For convenience I wrote a script to do the job, but you can also do it manually. Open a DOS Prompt and type the following to write the bootsector to C:\win9x.bin:

    C:\> debug
    -N win9x.bin
    -L 0 2 0 1
    -R CX
    :200
    -W 0
    -Q
    
  7. Run the partition editor again, unhide the Windows 2000 partition and mark it as bootable (active). Do not hide the Windows 9x partition.

  8. Reboot. If Windows 2000 doesn't start, boot the Recovery Console from your Windows 2000 CD, log in and run the commands fixmbr and fixboot, then reboot again.
  9. If you haven't already exported the Windows 9x bootsector into a file, do it now by using DiskProbe (see note below):

    1. Start → Programs → Windows 2000 Support Tools → Tools → DiskProbe
    2. Drive → Logical Volume…, double-click the drive letter of the Windows 9x partition, click "Set Active" and "OK".
    3. Sectors → Read and click "Read" (Starting Sector: 0, Number of Sectors: 1) to read the bootsector.
    4. File → Save As… and save it as C:\win9x.bin.
    5. File → Exit

    Otherwise copy it from wherever you saved it (most likely the Windows 9x partition) to C:\.

  10. Finally edit C:\boot.ini and append the line

    C:\win9x.bin="Windows 9x"
    
I suggest that you remove the drive letter of the Windows 9x partition in the disk management console, so you won't be tempted to use programs or data residing on that unprotected FAT file system (security was the reason why we didn't simply install Windows 2000 alongside Windows 9x on a FAT32 partition, remember?).

It is a good idea to adjust the access permissions of your system as described in security bulletin MS02-064. In addition to that I usually restrict access permissions to the system files in C:\ to Administrators and SYSTEM only (full access) and write-protect and hide them as well.

Note: If you don't seem to have a file C:\boot.ini, it is most likely just your Explorer being configured to not show hidden files. More information on the boot.ini can be found at Microsoft.

Note: DiskProbe is part of the Windows 2000 Support Tools, which are not included in a vanilla Windows 2000 setup. You have to install them from the Windows 2000 CD (directory \SUPPORT\TOOLS).

Note: Using the NT bootloader as a boot manager for Windows 9x is limited to only one Windows 9x installation. If you want to multi-boot several Windows 9x installations, you are going to need some other boot manager.

Dual-booting Windows 9x and Windows 2000
(Windows 9x installed first)

If you already have installed Windows 9x, but want to avoid the disadvantages of having the bootloader installed onto the Windows 9x partition, you have to make a slightly different approach:

  1. Make sure you have some free space left on your harddisk (I suggest at least 2-3 GB).
  2. Now write the bootsector to a file (you may as well skip this step and catch up on it from within Windows 2000).

    For convenience I wrote a script to do the job, but you can also do it manually. Open a DOS Prompt and type the following to write the bootsector to C:\win9x.bin:

    C:\> debug
    -N win9x.bin
    -L 0 2 0 1
    -R CX
    :200
    -W 0
    -Q
    
  3. Run a partition editor of your choice and hide the Windows 9x partition (you may need to reboot to DOS to do that).

  4. Install Windows 2000 and the Windows 2000 Support Tools (on the Windows 2000 CD in the directory \SUPPORT\TOOLS).
  5. Run the partition editor again, unhide the Windows 9x partition but leave your Windows 2000 partition marked as bootable (active).
  6. Run the disk management console and assign a drive letter to your Windows 9x partition.
  7. If you haven't already exported the Windows 9x bootsector into a file, do it now by using DiskProbe:

    1. Start → Programs → Windows 2000 Support Tools → Tools → DiskProbe
    2. Drive → Logical Volume…, double-click the drive letter of the Windows 9x partition, click "Set Active" and "OK".
    3. Sectors → Read and click "Read" (Starting Sector: 0, Number of Sectors: 1) to read the bootsector.
    4. File → Save As… and save it as C:\win9x.bin.
    5. File → Exit

    Otherwise copy it from wherever you saved it (most likely the Windows 9x partition) to C:\.

  8. Edit C:\boot.ini and append the line

     C:\win9x.bin="Windows 9x"
    
I suggest that you remove the drive letter of the Windows 9x partition in the disk management console, so you won't be tempted to use programs or data residing on that unprotected FAT file system (security was the reason why we didn't simply install Windows 2000 alongside Windows 9x on a FAT32 partition, remember?).

It is a good idea to adjust the access permissions of your system as described in security bulletin MS02-064. In addition to that I usually restrict access permissions to the system files in C:\ to Administrators and SYSTEM only (full access) and write-protect and hide them as well.

Note: If you don't seem to have a file C:\boot.ini, it is most likely just your Explorer being configured to not show hidden files. More information on the boot.ini can be found at Microsoft.

Note: Using the NT bootloader as a boot manager for Windows 9x is limited to only one Windows 9x installation. If you want to multi-boot several Windows 9x installations, you are going to need some other boot manager.

Dual-booting Linux and Windows 2000

Ironically, making Windows 2000 and Linux dual-boot is somewhat easier than making Windows 2000 and Windows 9x dual-boot.

  1. First install Windows 2000.
  2. I suggest you create an additional FAT32 partition for easier data exchange between Windows and Linux.
  3. Reboot and install Linux. Be sure to install the bootloader into the Linux boot partition (or root partition if you don't use a separate boot partition), not the MBR. For the examples below I will assume it is installed to /dev/hda5.
  4. Write the Linux bootsector to a file before you reboot for the first time! If you created a FAT32 partition earlier (assume it is /dev/hda7), you can save the bootsector file there:

    mount -t vfat /dev/hda7 /mnt
    dd if=/dev/hda5 of=/mnt/linux.bin bs=512 count=1
    umount /mnt
    

    Otherwise use e.g. a floppy disk to do so:

    mount /floppy
    dd if=/dev/hda5 of=/floppy/linux.bin bs=512 count=1
    umount /floppy
    

    This writes the bootsector to the file linux.bin either on the FAT32 partition or a floppy disk.

  5. Boot into Windows and copy linux.bin to C:\.
  6. Edit C:\boot.ini and append the line

    C:\linux.bin="Linux"
    
  7. You have a dual-boot system now. Reboot into Linux and finish the installation.

It is a good idea to adjust the access permissions of your system as described in security bulletin MS02-064. In addition to that I usually restrict access permissions to the system files in C:\ to Administrators and SYSTEM only (full access) and write-protect and hide them as well.

Note: Whenever you install a new kernel, you will have to reinstall the Linux bootloader (at least if you're using the Linux Loader lilo, not sure how other bootloaders handle that) and repeat the procedure of exporting and copying the bootsector.

Note: I was able to export the Linux bootsector by temporarily assigning the Linux boot partition a drive letter and exporting the bootsector via DiskProbe. For some reason this worked with Windows 2000, but not with Windows XP.

Posted 12:49 [permalink]