So you think it can't happen to you? Well, this is the scene:
What did I do? I recovered the system with linux, thats what I did. The system here is set up to dual boot with Windows95 and three different Linux distributions via LILO, the Linux boot loader.
Since the Master Boot Record on sector 0 is booting DOS and Linux, I thought it was prudent to use the DOS version of fdisk to try to recover the partition table. Ha! "What a lack of features you have, Grandma."said little Red LinuxHat.
The job I tried to do was to boot with my Windows95 rescue disk, which you make before this ever happens. You do have one, don't you? For a simple boot diskette, pop a floppy in the "A:" drive and type "sys a:".
Once the diskette boots, you try to cd to "C:" drive. Ha! It is not there. It is gone. The first thing to try is fdisk (DOS), to see what it can do. The upshot is that it don't do much. All that fdisk (DOS) said to me was that the hard disk was empty, with no partitions. Yikes, what a mess. The other hard disk, which has two DOS partitions, was fine. BUT, the Master Boot Record was gone. I used the command fdisk /MBR and nothing happened, nothing changed. According to fdisk (DOS), there was no partition table, no partition and you are out of luck. I suppose this lack of features is designed to have me running to a data recovery specialist to get "saved" for a fair exchange of dollars.
Now that you have proved that the other system is lacking some power, it is time to boot linux. I grabbed a boot disk, which you make before this ever happens. You do have one, don't you? In RedHat you simply put a blank diskette in the floppy drive and type mkbootdisk. Man oh man, I love linux! No clickety-clicks, no waiting, just service and super powers. I guess it helps when your software is written by the best and brightest minds in a free thought environment.
The RedHat boot image for installation is also a rescue diskette. Tell it you are doing the "expert" mode (I am not but you may be one) and press "Enter". Tell it if you have a colour terminal and configure the keyboard. Now put in the supp.img diskette and press "Enter". You get a "# _" prompt. Type this:
mknod /dev/hda b 3 0
Now you have a new device called /dev/hda. It is your original old hard disk drive.
The next thing is to mount your old root partition and run lilo. So cd to / and make a new directory to mount the thing: mkdir any_name_will_do. Type this:
mount /dev/hd_your_root_partition_here /any_name_will_do
Then cd to /any_name_will_do/sbin and run lilo. Type this:
./lilo -C /any_name_will_do/etc/lilo.conf
The fdisk (GNU/Linux) is able to make your partitions and set the file type for them. Also, it can verify the partition table. So, in my time of need this is what I did. I typed "v" for verify.
The program reported to me that the partition table had been altered! No kidding. Then I typed "w" to write the table to the disk and quit fdisk.
The system rebooted perfectly as usual. Linux wins again.
Yeah, I watched the Fifth Element several times. The LILO boot loader can easily re-write the Master Boot Record just by running it once on its /etc/lilo.conf file. Type /sbin/lilo and the job is done. You may now boot from the hard disk drive.
The DOS fdisk can alter your view of the world. When you have only one hard disk drive it will let you make one and only one primary partition. If you have a second HDD it will let you make the four primary partitions allowed by the PC's designers or three primary and one extended.
When you have only one primary partition then you can't be trying to boot more than one type of Operating System. Normally, that is. Linux can boot from a logical drive on an extended partition with loadlin.exe.
I guess it must be too hard to compete on the merits of the product, so the DOS Borg must use this type of anti-competitive approach in order to maintain market share. Just imagine one primary partition covering 100% of the disk. "Yeah, that will keep them from even trying to get a real OS".
Frighten them with dire warnings, too. Tell them their system has performed illegal operations and general protection faults.
In my mind, Microsoft is the illegal operation and the DOJ is guilty of general protection faults from not protecting the public in general.
With good reason, too. DOS always writes over the Master Boot Record when you install it. The beast has the arrogance to exclude all other possible operating systems when it is time to install. This is not an oversight, it is not a test. You are caught square in the middle of the cut-throat world of big business. Get used to it gentle linuxian, your system has been discovered by the rest of the world. They say "Defend your turf or die". I say "remember the Apple" and let us not have it happen again that an excellent system gets shoved aside and marginalized as a specialty item. Linux can do EVERYTHING. Lets bring it on!
Clock mini-HOWTO -- required reading for real-time Linuxians
Large Disk mini-HOWTO -- excellent Master Boot Record discussion
Linux+DOS+Win95 mini-HOWTO -- here's a good /etc/lilo.conf example
Partition mini-HOWTO -- required reading for all linuxians
The adamant position of the author is in no way meant as an affront to sincere readers.