Adding New Partitions, Filesystems, and Swap

Reading the Red Hat Exam Prep guide carefully, this skill states that RHCTs should be able to add new partitions, filesystems, and swap to existing systems (I've added the boldface to provide emphasis on this particular Exam Prep requirement). This implies that space is available on the hard drive(s) that you are using during your exam.

You need to know how to add new partitions, which suggests that you need to know how to use the fdisc and parted utilities described in chapter 4. When you create a new partition, make sure the partition type is associated with what you're creating; there are different partition types for standard Linux and swap partitions.

This is one exercise that does not require a partner. However, it assumes that you've installed RHEL with extra available space on any existing hard drives. If you don't have any additional space, you can substitute a spare USB key.

This exercise assumes you'll be creating a partition on a second SATA or SCSI hard drive. If you're using a different drive and partition, substitute device file names accordingly.

  1. If you've configured a VMware machine to practice for the Red Hat exam, take a snapshot of your current configuration (unless you're willing to keep the changes made during this exercise).

  2. Run the fdisk -l command to display configured partitions. The cylinders will tell you if space is available. For example, the following output suggests that 5000 cylinders are free:

    Disk /dev/sdb: 160.0 GB, 160041885696 bytes
    255 heads, 63 sectors/track, 19457 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 9205 73939131 83 Linux
    /dev/sdb2 9206 14457 42349190 83 Linux
  3. Add a new partition of 500MB. It doesn't have to be exact. Make sure that the partition type is associated with Linux. I don't specify exact steps, as you can use either fdisc or parted to create the new partition.

  4. Write the changes to disk, and use the partprobe command or reboot the system.

  5. Format the new partition. For example, if the new partition device is /dev/sdb3, you can do so with the mkfs.ext3 /dev/sdb3 command.

  6. Assign the partition to user michael's home directory in /etc/fstab. (Create user michael if needed.) For example, if the partition device is /dev/sdb3, you can do so with the following directive in that file:

    /dev/sdb3    /home/michael     ext3     defaults     1 2
  7. Mount /dev/sdb3 on the /home/michael directory. Reboot your system to make sure your system recognizes the changes and mounts the new partition.

  8. Run the fdisk -l, mount, and df commands to verify the new partition.

  9. If you took a VMware snapshot, press the Revert button in the VMware window to revert to the snapshot.