How To Remove LILO So the System Boots DOS Again?

How To Remove LILO So the System Boots DOS Again?

The lilo program (not the complete LILO package), uses the command
line option -u to uninstall the LILO boot loader. You have to supply
the device name of the device you installed LILO on, for example:

lilo -u /dev/hda

This rewrites the original, pre-LILO master boot record back to the
first hard drive, from the boot record saved in /boot/boot.0300. If
you installed LILO to a partition as a secondary boot loader, for
example, /dev/hda1, lilo re-installs the original boot sector from the
save file /boot/boot.0301. Refer to the lilo manual page for details.
Thanks to Villy Kruse for reminding me to update this answer.

If you have an earlier version of LILO, you will have to use the DOS
(MS-DOS 5.0 or later, or OS/2) FDISK /MBR (which is not documented).
This will restore a standard MS-DOS Master Boot Record. If you have
DR-DOS 6.0, go into FDISK.EXE in the normal way and then select the
Re-write Master Boot Record option.

If you create a boot floppy during the Windows installation process,
make sure that it contains the programs FDISK.EXE, FORMAT.COM, and
SYS.COM, and use that to re-install MS-DOS on the hard disk.

If you don't have MS-DOS or DR-DOS, you need to have the boot sector
that LILO saved when you first installed it. You did keep that file,
didn't you? It's probably called boot.0301 or some such. Type:

dd if=boot.0301 of=/dev/hda bs=445 count=1

(or /dev/sda if you're using a SCSI disk). This may also wipe out your
partition table, so beware! If you're desperate, you could use

dd if=/dev/zero of=/dev/hda bs=512 count=1

This will erase your partition table and boot sector completely: you
can then reformat the disk using your favorite software. But this will
render the contents of your disk inaccessible--you'll lose it all
unless you're an expert.

Note that the DOS MBR boots whichever (single!) partition is flagged
as "active." You may need to use fdisk to set and clear the active
flags on partitions appropriately.



Home
FAQ