Chapter 5. Removing Red Hat Enterprise Linux

Chapter 5. Removing Red Hat Enterprise Linux

To uninstall Red Hat Enterprise Linux from your x86-based system, you must remove the Red Hat Enterprise Linux boot loader information from your master boot record (MBR).

Note

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 ONLY rewrites 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, a boot prompt appears. At the boot prompt, type: linux rescue. This starts the rescue mode program.

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

Next, a screen appears telling you that the program attempts to find a Red Hat Enterprise Linux install to rescue. Select Skip on this screen.

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

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

Warning

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 also displays the partition's type (such as linux-swap, ext2, ext3, and so on). Knowing the type of the partition helps 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

Important

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 .


Note: This documentation is provided {and copyrighted} by Red Hat®, Inc. and is released via the Open Publication License. The copyright holder has added the further requirement that Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. The CentOS project redistributes these original works (in their unmodified form) as a reference for CentOS-5 because CentOS-5 is built from publicly available, open source SRPMS. The documentation is unmodified to be compliant with upstream distribution policy. Neither CentOS-5 nor the CentOS Project are in any way affiliated with or sponsored by Red Hat®, Inc.