Cari di RHE Linux 
    Red Hat Enterprise Linux Manual
Daftar Isi
(Sebelumnya) 1 : Chapter 35. Your Next Step ...1 : Part VI. Technical appendi ... (Berikutnya)

Installation Guide

Chapter 39. Removing Red Hat Enterprise Linux from x86-based systems

These instructions may destroy data!

If you have data from Red Hat Enterprise Linux that you want to keep, back it up before you proceed. Write your data to CD, DVD, external hard disk, or other storage device.
As a precaution, also back up data from any other operating systems that are installed on the same computer. Mistakes do happen and can result in the loss of all your data.
If you back up data from Red Hat Enterprise Linux to be used later in another operating system, make sure that the storage medium or device is readable by that other operating system. For example, without extra third-party software, Microsoft Windows cannot read an external hard drive that you have formatted with Red Hat Enterprise Linux to use the ext2, ext3, or ext4 file system.
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) and remove any partitions that contain the operating system. The method for removing Red Hat Enterprise Linux from your computer varies, depending on whether Red Hat Enterprise Linux is the only operating system installed on the computer, or whether the computer is configured to dual-boot Red Hat Enterprise Linux and another operating system.
These instructions cannot cover every possible computer configuration. If your computer is configured to boot three or more operating systems, or has a highly-customized partition scheme, use the following sections as a general guide to partition removal with the various tools described. In these situations, you will also need to learn to configure your chosen bootloader. See Appendix E, The GRUB Boot Loader for a general introduction to the subject, but detailed instructions are beyond the scope of this document.

Legacy versions of Microsoft operating systems

Fdisk, the disk partitioning tool provided with MS-DOS and Microsoft Windows, is unable to remove the file systems used by Red Hat Enterprise Linux. MS-DOS and versions of Windows prior to Windows XP (except for Windows 2000) have no other means of removing or modifying partitions. Refer to Section 39.3, "Replacing Red Hat Enterprise Linux with MS-DOS or legacy versions of Microsoft Windows" for alternative removal methods for use with MS-DOS and these versions of Windows.

39.1. Red Hat Enterprise Linux is the only operating system on the computer

If Red Hat Enterprise Linux is the only operating system on your computer, use the installation media for the replacement operating system to remove Red Hat Enterprise Linux. Examples of installation media include the Windows XP installation CD, Windows Vista installation DVD, or the installation CD, CDs, or DVD of another Linux distribution.
Note that some manufacturers of factory-built computers pre-installed with Microsoft Windows do not supply the Windows installation CD or DVD with the computer. The manufacturer may instead have supplied their own "system restore disc", or have included software with the computer that allowed you to create your own "system restore disc" when you first started the computer. In some cases, the system restore software is stored on a separate partition on the system's hard drive. If you cannot identify the installation media for an operating system that was pre-installed on your computer, consult the documentation supplied with the machine, or contact the manufacturer.
When you have located the installation media for your chosen operating system:
  1. Back up any data that you want to keep.
  2. Shut down the computer.
  3. Boot your computer with the installation disc for the replacement operating system.
  4. Follow the prompts presented during the installation process. Windows, OS X, and most Linux installation discs allow you to manually partition your hard drive during the installation process, or will offer you the option to remove all partitions and start with a fresh partition scheme. At this point, remove any existing partitions that the installation software detects or allow the installer to remove the partitions automatically. "System restore" media for computers pre-installed with Microsoft Windows might create a default partition layout automatically without input from you.

    Warning

    If your computer has system restore software stored on a partition on a hard drive, take care when removing partitions while installing an operating system from other media. Under these circumstances, you could destroy the partition holding the system restore software.

39.2. Your computer dual-boots Red Hat Enterprise Linux and another operating system

If your computer is configured to dual-boot Red Hat Enterprise Linux and another operating system, removing Red Hat Enterprise Linux without removing the partitions containing the other operating system and its data is more complicated. Specific instructions for a number of operating systems are set out below. To keep neither Red Hat Enterprise Linux nor the other operating system, follow the steps described for a computer with only Red Hat Enterprise Linux installed: Section 39.1, "Red Hat Enterprise Linux is the only operating system on the computer"

39.2.1. Your computer dual-boots Red Hat Enterprise Linux and a Microsoft Windows operating system

39.2.1.1. Windows 2000, Windows Server 2000, Windows XP, and Windows Server 2003

Warning

Once you commence this process, your computer may be left in an unbootable state until you complete the entire set of instructions. Carefully read the steps below before beginning the removal process. Consider opening these instructions on another computer or printing them so that you have access to them at all times during the process.
This procedure relies on the Windows Recovery Console that loads from the Windows installation disk, so you will not be able to complete the procedure without access to this disk. If you start this procedure and do not complete it, you could leave your computer in a condition where you cannot boot it. The "system restore disk" supplied with some factory-built computers that are sold with Windows pre-installed on them might not include the Windows Recovery Console.
During the process outlined in these instructions, the Windows Recovery Console will prompt you for the Administrator password for your Windows system. Do not follow these instructions unless you know the Administrator password for your system or are certain that an Administrator password has never been created, even by the computer manufacturer.
  1. Remove the Red Hat Enterprise Linux partitions
    1. Boot your computer into your Microsoft Windows environment.
    2. Click Start>Run..., type diskmgmt.msc and press Enter. The Disk Management tool opens.
      The tool displays a graphical representation of your disk, with bars representing each partition. The first partition is usually labeled NTFS and corresponds to your C: drive. At least two Red Hat Enterprise Linux partitions will be visible. Windows will not display a file system type for these partitions, but may allocate drive letters to some of them.
    3. Right-click on one of the Red Hat Enterprise Linux partitions, then click Delete Partition and click Yes to confirm the deletion. Repeat this process for the other Red Hat Enterprise Linux partitions on your system. As you delete partitions, Windows labels the space on the hard drive previously occupied by those partitions as unallocated.
  2. Enable Windows to use the space on your hard drive vacated by Red Hat Enterprise Linux (optional)

    Note

    This step is not required to remove Red Hat Enterprise Linux from your computer. However, if you skip this step, you will leave part of your hard drive's storage capacity unusable by Windows. Depending on your configuration, this might be a significant portion of the storage capacity of the drive.
    Decide whether to extend an existing Windows partition to use the extra space, or create a new Windows partition in that space. If you create new a Windows partition, Windows will allocate a new drive letter to it and will interact with it as if it is a separate hard drive.

    Extending an existing Windows partition

    Note

    The diskpart tool used in this step is installed as part of the Windows XP and Windows 2003 operating systems. If you are performing this step on a computer running Windows 2000 or Windows Server 2000, you can download a version of diskpart for your operating system from the Microsoft website.
    1. Click Start>Run..., type diskpart and press Enter. A command window appears.
    2. Type list volume and press Enter. Diskpart displays a list of the partitions on your system with a volume number, its drive letter, volume label, filesystem type, and size. Identify the Windows partition that you would like to use to occupy the space vacated on your hard drive by Red Hat Enterprise Linux and take note of its volume number (for example, your Windows C: drive might be "Volume 0").
    3. Type select volume N (where N is the volume number for the Windows partition that you want to extend) and press Enter. Now type extend and press Enter. Diskpart now extends your chosen partition to fill the remaining space on your hard drive. It will notify you when the operation is complete.

    Adding a new Windows partition

    1. In the Disk Management window, right-click on disk space that Windows labels as unallocated and select New Partition from the menu. The New Partition Wizard starts.
    2. Follow the prompts presented by the New Partition Wizard. If you accept the default options, the tool will create a new partition that fills all available space on the hard drive, assigns it the next available drive letter, and formats it with the NTFS file system.
  3. Restore the Windows bootloader
    1. Insert the Windows installation disk and restart your computer. As your computer starts, the following message will appear on the screen for a few seconds:
      Press any key to boot from CD
      Press any key while the message is still showing and the Windows installation software will load.
    2. When the Welcome to Setup screen appears, you can start the Windows Recovery Console. The procedure is slightly different on different versions of Windows:
      • On Windows 2000 and Windows Server 2000, press the R key, then the C key.
      • On Windows XP and Windows Server 2003, press the R key.
    3. The Windows Recovery Console scans your hard drives for Windows installations, and assigns a number to each one. It displays a list of Windows installations and prompts you to select one. Type the number corresponding to the Windows installation that you want to restore.
    4. The Windows Recovery Console prompts you for the Administrator password for your Windows installation. Type the Administrator password and press the Enter key. If there is no administrator password for this system, press only the Enter key.
    5. At the prompt, type the command fixmbr and press the Enter. The fixmbr tool now restores the Master Boot Record for the system.
    6. When the prompt reappears, type exit and press the Enter key.
    7. Your computer will restart and boot your Windows operating system.

39.2.1.2. Windows Vista and Windows Server 2008

Warning

Once you commence this process, your computer may be left in an unbootable state until you complete the entire set of instructions. Carefully read the steps below before beginning the removal process. Consider opening these instructions on another computer or printing them so that you have access to them at all times during the process.
This procedure relies on the Windows Recovery Environment that loads from the Windows installation disk and you will not be able to complete the procedure without access to this disk. If you start this procedure and do not complete it, you could leave your computer in a condition where you cannot boot it. The "system restore disk" supplied with some factory-built computers that are sold with Windows pre-installed on them might not include the Windows Recovery Environment.
  1. Remove the Red Hat Enterprise Linux partitions
    1. Boot your computer into your Microsoft Windows environment.
    2. Click Start then type diskmgmt.msc into the Start Search box and press Enter. The Disk Management tool opens.
      The tool displays a graphical representation of your disk, with bars representing each partition. The first partition is usually labeled NTFS and corresponds to your C: drive. At least two Red Hat Enterprise Linux partitions will be visible. Windows will not display a file system type for these partitions, but may allocate drive letters to some of them.
    3. Right-click on one of the Red Hat Enterprise Linux partitions, then click Delete Partition and click Yes to confirm the deletion. Repeat this process for the other Red Hat Enterprise Linux partitions on your system. As you delete partitions, Windows labels the space on the hard drive previously occupied by those partitions as unallocated.
  2. Enable Windows to use the space on your hard drive vacated by Red Hat Enterprise Linux (optional)

    Note

    This step is not required to remove Red Hat Enterprise Linux from your computer. However, if you skip this step, you will leave part of your hard drive's storage capacity unusable by Windows. Depending on your configuration, this might be a significant portion of the storage capacity of the drive.
    Decide whether to extend an existing Windows partition to use the extra space, or create a new Windows partition in that space. If you create new a Windows partition, Windows will allocate a new drive letter to it and will interact with it as if it is a separate hard drive.

    Extending an existing Windows partition

    1. In the Disk Management window, right-click on the Windows partition that you want to extend and select Extend Volume from the menu. The Extend Volume Wizard opens.
    2. Follow the prompts presented by the Extend Volume Wizard. If you accept the defaults that it offers you, the tool will extend the selected volume to fill all available space on the hard drive.

    Adding a new Windows partition

    1. In the Disk Management window, right-click on disk space that Windows labels as unallocated and select New Simple Volume from the menu. The New Simple Volume Wizard starts.
    2. Follow the prompts presented by the New Simple Volume Wizard. If you accept the default options, the tool will create a new partition that fills all available space on the hard drive, assigns it the next available drive letter, and formats it with the NTFS file system.
  3. Restore the Windows bootloader
    1. Insert the Windows installation disk and restart your computer. As your computer starts, the following message will appear on the screen for a few seconds:
      Press any key to boot from CD or DVD
      Press any key while the message is still showing and the Windows installation software will load.
    2. In the Install Windows dialog, select a language, time and currency format, and keyboard type. Click Next
    3. Click Repair your computer.
    4. The Windows Recovery Environment (WRE) shows you the Windows installations that it can detect on your system. Select the installation that you want to restore, then click Next.
    5. Click Command prompt. A command window will open.
    6. Type bootrec /fixmbr and press Enter.
    7. When the prompt reappears, close the command window, then click Restart.
    8. Your computer will restart and boot your Windows operating system.

39.2.2. Your computer dual-boots Red Hat Enterprise Linux and a different Linux distribution

Because of the differences between the many different Linux distributions, these instructions are a general guide only. Specific details vary according to the configuration of your particular system and the Linux distribution that dual-boots with Red Hat Enterprise Linux.
  1. Procedure 39.1. Remove Red Hat Enterprise Linux partitions

    1. Boot your Red Hat Enterprise Linux installation.
    2. As root or with sudo, run mount. Note the partitions that are mounted. In particular, note the partition that is mounted as the root of the filesystem. The output of mount on a system where the root of the filesystem is on a standard partition such as /dev/sda2 might resemble:
      /dev/sda2 on / type ext4 (rw)proc on /proc type proc (rw)sysfs on /sys type sysfs (rw)devpts on /dev/pts type devpts (rw,gid=5,mode=620)tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")/dev/sda1 on /boot type ext4 (rw)none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
      The output of mount on a system where the root of the filesystem is on a logical volume might resemble:
      /dev/mapper/VolGroup00-LogVol00 on / type ext4 (rw)proc on /proc type proc (rw)sysfs on /sys type sysfs (rw)devpts on /dev/pts type devpts (rw,gid=5,mode=620)tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")/dev/sda1 on /boot type ext4 (rw)none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
    3. Ensure that any data on this system that you still require is backed up to another system or storage location.
    4. Shut down the system and boot the Linux distribution that you want to keep on the system.
    5. As root or with sudo, run mount. If any of the partitions that you previously noted as used for Red Hat Enterprise Linux are mounted, review the contents of these partitions. If you no longer require the contents of these partitions, unmount them with the umount command.
    6. Remove any unwanted and unnecessary partitions, for example, with fdisk for standard partitions, or lvremove and vgremove to remove logical volumes and volume groups.
  2. Remove Red Hat Enterprise Linux entries from your bootloader

    Example only

    These instructions assume that your system uses the GRUB bootloader. If you use a different bootloader (such as LILO) consult the documentation for that software to identify and remove Red Hat Enterprise Linux entries from its list of boot targets and to ensure that your default operating system is correctly specified.
    1. At the command line, type su - and press Enter. When the system prompts you for the root password, type the password and press Enter.
    2. Type gedit /boot/grub/grub.conf and press Enter. This opens the grub.conf file in the gedit text editor.
    3. A typical Red Hat Enterprise Linux entry in the grub.conf file consists of four lines:

      Example 39.1. Example Red Hat Enterprise Linux entry in grub.conf

      title Red Hat Enterprise Linux (2.6.32.130.el6.i686)
      root (hd0,1)
      kernel /vmlinuz-2.6.32.130.el6.i686 ro root=UUID=04a07c13-e6bf-6d5a-b207-002689545705 rhgb quiet
      initrd /initrd-2.6.32.130.el6.i686.img

      Depending on the configuration of your system, there may be multiple Red Hat Enterprise Linux entries in grub.conf, each corresponding to a different version of the Linux kernel. Delete each of the Red Hat Enterprise Linux entries from the file.
    4. Grub.conf contains a line that specifies the default operating system to boot, in the format default=N where N is a number equal to or greater than 0. If N is set to 0, GRUB will boot the first operating system in the list. If N is set to 1, it will boot the second operating system, and so forth.
      Identify the entry for the operating system that you want GRUB to boot by default and note its place in the order within the list.
      Make sure that the default= line contains the number one below the number of your chosen default operating system in the list.
      Save the updated grub.conf file and close gedit
  3. Make space available to your operating system

    Note

    This step is not required to remove Red Hat Enterprise Linux from your computer. However, if you skip this step, you will leave part of your hard drive's storage capacity unusable by your other Linux operating system. Depending on your configuration, this might be a significant portion of the storage capacity of the drive.

    Note

    To carry out this step, you require live media for a Linux distribution, for example, the Fedora Live CD or the Knoppix DVD.
    The method to make the space freed by removing the Red Hat Enterprise Linux partitions available to your other Linux operating system differs, depending on whether your chosen operating system is installed on disk partitions configured to use Logical Volume Management (LVM) or not.
    • If you do not use LVM

      1. Boot your computer from Linux live media, and install parted if it is not already present.
      2. As root or with sudo, run parted disk, where disk is the device name of the disk that contains a partition that you want to resize, for example, /dev/sda.
      3. At the (parted) prompt, enter print. The parted tool displays information about the partitions on your system, including their partition numbers, their sizes, and their positions on the disk.
      4. At the (parted) prompt, enter resize number start end, where number is the partition number, start is the location on the disk at which the partition begins, and end is the location on the disk at which you want the partition to end. Use the start position that you previously obtained with the print command, and refer to the parted documentation for different ways to specify the end parameter.
      5. When parted finishes resizing the partition, enter quit at the (parted) prompt.
      6. Run e2fsck partition, where partition is the partition that you just resized. For example, if you just resized /dev/sda3, enter e2fsck /dev/sda3.
        Linux now checks the file system of the newly-resized partition.
      7. When the file system check finishes, type resize2fs partition at a command line and press Enter, where partition is the partition that you just resized. For example, if you just resized /dev/sda3, type resize2fs /dev/sda3.
        Linux now resizes your file system to fill the newly-resized partition.
      8. Restart your computer. The extra space is now available to your Linux installation.
    • If you use LVM

      1. Boot your computer from Linux live media and install fdisk and lvm2 if they are not already present.
      2. Create a new partition in the free space on the disk

        1. As root or with sudo, run fdisk disk, where disk is the device name of the disk where you want to create new space, for example, /dev/sda.
        2. At the prompt Command (m for help):, enter n to create a new partition. Refer to the fdisk documentation for options.
      3. Change the partition type identifier

        1. At the prompt Command (m for help):, enter t to change a partition type.
        2. At the prompt Partition number (1-4):, type the number of the partition that you just created. For example, if you just created partition /dev/sda3, type the number 3 and press Enter. This identifies the partition whose type fdisk will change.
        3. At the prompt Hex code (type L to list codes):, enter 8e to create a Linux LVM partition.
        4. At the prompt Command (m for help):, enter w to write the changes to disk and exit fdisk.
      4. Expand the volume group

        1. At the command prompt, type lvm and press Enter to start the lvm2 tool.
        2. At the lvm> prompt, type pvcreate partition and press Enter, where partition is the partition that you recently created. For example, pvcreate /dev/sda3. This creates /dev/sda3 as a physical volume in LVM.
        3. At the lvm> prompt, type vgextend VolumeGroup partition and press Enter, where VolumeGroup is the LVM volume group on which Linux is installed and partition is the partition that you recently created. For example, if Linux is installed on /dev/VolumeGroup00, you would type vgextend /dev/VolumeGroup00 /dev/sda3 to extend that volume group to include the physical volume at /dev/sda3.
        4. At the lvm> prompt, type lvextend -l +100%FREE LogVol and press Enter, where LogVol is the logical volume that contains your Linux filesystem. For example, to extend LogVol00 to fill the newly-available space in its volume group, VolGroup00, type lvextend -l +100%FREE /dev/VolGroup00/LogVol00.
        5. At the lvm> prompt, type exit and press Enter to exit lvm2
      5. Type e2fsck LogVol at the command line and press Enter, where LogVol is the logical volume that you just resized. For example, if you just resized /dev/VolumeGroup00/LogVol00, you would type e2fsck /dev/VolumeGroup00/LogVol00.
        Linux now checks the file system of the newly-resized logical volume.
      6. When the file system check finishes, type resize2fs LogVol at a command line and press Enter, where LogVol is the partition that you just resized. For example, if you just resized /dev/VolumeGroup00/LogVol00, you would type resize2fs /dev/VolumeGroup00/LogVol00.
        Linux now resizes your file system to fill the newly-resized logical volume.
      7. Restart your computer. The extra space is now available to your Linux installation.

39.3. Replacing Red Hat Enterprise Linux with MS-DOS or legacy versions of Microsoft Windows

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 DVD and boot your system. When the boot prompt appears, 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, ext4 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 .

Chapter 40. Removing Red Hat Enterprise Linux from IBM System z

If you want to delete the existing operating system data, first, if any Linux disks contain sensitive data, ensure that you destroy the data according to your security policy. To proceed you can consider these options:
  • Overwrite the disks with a new installation.
  • Start a new installation and use the partitioning dialog (refer to Section 23.13, "Disk Partitioning Setup") to format the partitions where Linux was installed. After the Write changes to disk dialog described in Section 23.16, "Write changes to disk", exit the installer.
  • Make the DASD or SCSI disk where Linux was installed visible from another system, then delete the data. However, this might require special privileges. Ask your system administrator for advice. You can use Linux commands such as dasdfmt (DASD only), parted, mke2fs or dd. For more details about the commands, refer to the respective man pages.

40.1. Running a Different Operating System on your z/VM Guest or LPAR

If you want to boot from a DASD or SCSI disk different from where the currently installed system resides under a z/VM guest virtual machine or an LPAR, shut down the Red Hat Enterprise Linux installed and use the desired disk, where another Linux instance is installed, to boot from. This leaves the contents of the installed system unchanged.
(Sebelumnya) 1 : Chapter 35. Your Next Step ...1 : Part VI. Technical appendi ... (Berikutnya)