Appendix B. Removing Red Hat Enterprise Linux

To uninstall Red Hat Enterprise Linux from your system, you must remove the GRUB or LILO information from your master boot record (MBR).

NoteNote
 

It is always a good idea to backup any data that you have on your system(s). Mistakes do happen and can result in the loss all of your data.

In DOS and Windows, use the Windows fdisk utility to create a new MBR with the undocumented flag /mbr. This will ONLY rewrite the MBR to boot the primary DOS partition. The command should look like the following:

fdisk /mbr

If you need to remove Linux from a hard drive and have attempted to do this with the default DOS (Windows) fdisk, you will experience the Partitions exist but they do not exist problem. The best way to remove non-DOS partitions is with a tool that understands partitions other than DOS.

To begin, insert the Red Hat Enterprise Linux CD #1 and boot your system. Once you have booted off the CD, you will receive a boot prompt. At the boot prompt, type: linux rescue. This will start the rescue mode program.

You will be prompted for your keyboard and language requirements. Enter these values as you would during the installation of Red Hat Enterprise Linux.

Next, a screen will appear telling you that the program will now attempt to find a Red Hat Enterprise Linux install to rescue. Select Skip on this screen.

After selecting Skip, you will be given a command prompt where you can access the partitions you would like to remove.

First, type the command list-harddrives. This command will list all hard drives on your system that are recognizable by the installation program, as well as their sizes in megabytes.

WarningWarning
 

Be careful to remove only the necessary Red Hat Enterprise Linux partitions. Removing other partitions could result in data loss or a corrupted system environment.

To remove partitions, use the partitioning utility parted. Start parted, where /dev/hda is the device on which to remove the partition:

parted /dev/hda

Using the print command, view the current partition table to determine the minor number of the partition to remove:

print

The print command will also display the partition's type (such as linux-swap, ext2, ext3, and so on). Knowing the type of the partition will help you in determining whether to remove the partition.

Remove the partition with the command rm. For example, to remove the partition with minor number 3:

rm 3    

ImportantImportant
 

The changes start taking place as soon as you press [Enter], so review the command before committing to it.

After removing the partition, use the print command to confirm that it is removed from the partition table.

Once you have removed the Linux partitions and made all of the changes you need to make, type quit to quit parted.

After quitting parted, type exit at the boot prompt to exit rescue mode and reboot your system, instead of continuing with the installation. The system should reboot automatically. If it does not, you can reboot your computer using [Control]-[Alt]-[Delete].