MBR Hack and updated DNS hole

| | Comments (0)

Heard of the windows boot loader at all? If you haven't, it's called NTLDR. It actually does a really good job of being a boot loader, too, but with on exception. It MUST reside on an NTFS partition that is the first partition on the first drive that the BIOS sees. No exceptions. Windows expects this also, and likewise, won't boot unless it's booted like that. This kinda sucks for people who want to dual-boot windows and linux, because you have to either repartition to install linux on the first drive, or live without it (gasp). You can't install linux on a second drive, and use any linux boot loader to boot windows on the first hard drive. It just doesn't work.
Solution? The MBR hack.

Windows is installed on /dev/hda1. Linux /boot on /dev/hdb1. For the hack, I recommend grub, though I haven't tried it with grub, only lilo. Why grub is recommend will become quickly apparent.

With the above situation, there is no way to boot windows up from linux. Likewise, if you swap hda with hdb, windows still won't boot. So, once you have your linux boot loader installed on hdb, you image the MBR (master boot record) to a file, copy that file to the windows partition, and add an entry to C:\boot.ini to reference it. Let me put it in a little more verbose way:

dd if=/dev/hdb of=linux.mbr bs=512 count=1

cp linux.mbr /mnt/windows

echo C:\linux.mbr="Linux" >> /mnt/windows/boot.ini

And you're done. When the computer boots up NTLDR, you'll have a "Linux" option that'll pop up grub/lilo/whatever :)

And in case you didn't catch why grub is recommended: if you use lilo, you have to update the linux.mbr file every time you upgrade your kernel... which is typically stored on NTFS. Sure, the file size won't change, but it's another manual step that could be avoided easily with grub.

On another topic, I visited the University of Utah friday, for orientation (which they actually mis-scheduled me for, so I'll go again later). After 30 seconds of poking around, their network allows anything outgoing :53/udp to anywhere in the world. Oops.

Categories

, ,

Leave a comment

About this Entry

This page contains a single entry by Kyle Brantley published on July 24, 2006 9:57 AM.

A very happy raid5 array was the previous entry in this blog.

Bad idea: changing hostname/domainname while X is running is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.0