Product SiteDocumentation Site

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

Note

Because of the differences between the many different Linux distributions, these instructions are a general guide only. Specific details will vary according to your chosen distribution and the configuration of your particular computer. This example uses GParted as a partition editor and gedit as a text editor, but many other tools are available to perform these tasks. To follow these instructions exactly as written, install GParted and gedit.
  1. Remove Red Hat Enterprise Linux partitions
    1. Boot the Linux version that you want to keep on your computer.
    2. Open GParted, either from a desktop menu or by typing gparted at the command line and pressing Enter.
    3. GParted displays the partitions that it detects on your computer, both as a graph and as a table.
      Right-click the Red Hat Enterprise Linux partitions, then select Delete.
  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 38.1. Example Red Hat Enterprise Linux entry in grub.conf
      title Red Hat Enterprise Linux (2.6.27.19-170.2.35.el5.i686)
      root (hd0,1)
      kernel /vmlinuz-2.6.27.19-170.2.35.el5.i686 ro root=UUID=04a07c13-e6bf-6d5a-b207-002689545705 rhgb quiet
      initrd /initrd-2.6.27.19-170.2.35.el5.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 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 gparted if it is not already present.
      2. Open GParted, either from a desktop menu or by typing gparted at the command line and pressing Enter.
      3. GParted displays the partitions on your system both as a graph and as a table. Click on the partition that you want to extend to use the space freed by removing Red Hat Enterprise Linux, and click the Resize/Move button.
      4. A new dialog opens, allowing you to specify a new size for the partition by entering it as numbers, or by dragging the sides of the graphical representation of the partition so that it fills the available space. Click the Resize/Move button in this dialog to confirm your choice.
      5. Back in the main GParted window, click Apply. Take note of the name of the partition that you just resized, for example, /dev/sda3.
      6. When GParted finishes resizing the partition, type e2fsck 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, you would type 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, you would 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 gparted and lvm2 if they are not already present.
      2. Create a new partition in the free space on the disk
        1. Open GParted, either from a desktop menu or by typing gparted at the command line and pressing Enter.
        2. GParted displays the partitions on your system both as a graph and as a table. The space freed by removing Red Hat Enterprise Linux is labeled unallocated. Right-click on the unallocated space and select New. Accept the defaults and GParted will create a new partition that fills the space available on the drive.
        3. Click Apply. GParted writes the changes to your hard drive. Take note of the name of the partition that you just created, and the name of the device that holds the partition. For example, you may have created /dev/sda3 on device /dev/sda.
      3. Change the partition type identifier
        1. Fdisk is a partitioning tool capable of preparing partitions for LVM. At a command line, type fdisk device and press Enter, where device is the name of the device on which you just created a partition. For example, fdisk /dev/sda.
        2. At the prompt Command (m for help):, press T and Enter to use fdisk to change a partition type.
        3. 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.
        4. At the prompt Hex code (type L to list codes):, type the code 8e and press Enter. This is the code for a Linux LVM partition.
        5. At the prompt Command (m for help):, press W and Enter. Fdisk writes the new type code to the partition and exits.
      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.