LVM 2

Alexa is a new Linux Sysadmin at Red Hat. She is preparing to take the LFCS exam in a few weeks, and the RHCSA exam before the end of the year (it is currently May). Alexa's boss Joanna has tasked her with the following assignment to help her to master LVM.

  1. Go to Amazon.com and buy two 20 Terabyte hard drives and a 2 TB ssd along with all of the other components that you will need to build the machine: an Asus motherboard, and AMD Ryzen cpu, RAM, monitors etc.
  2. Build the computer install the latest version of Fedora Linux.
  3. The 2 TB SSD will be /dev/sda.
  4. The first 20TB spinning hard drive: /dev/sdb
  5. The second 20TB spinning hard drive: /dev/sdc
  6. Please use fdisk and other commands as necessary to do the following:
  7. The final result desired is that you have a 25 TB logical volume called "Important_Data" and 15 TB logical volume called "Backup Data". Only the two 20 TB spinning hard drives should be used to create the 2 logical volumes.
  8. Please show all of the commands that you used to make this happen. 

Here are the steps required to create the desired logical volumes on the two 20TB spinning hard drives (/dev/sdb and /dev/sdc) in a Fedora Linux system using LVM. Here are the steps that Alexa can follow:

  1. Install the two 20TB spinning hard drives and the 2TB SSD in the new computer and install Fedora Linux on the 2TB SSD (/dev/sda).

  2. Use the fdisk command to create a partition on each of the two 20TB spinning hard drives (/dev/sdb and /dev/sdc). For example:

    • sudo fdisk /dev/sdb

    • Then create a new partition of type Linux LVM (type 8e) by typing n and following the prompts.
    • Repeat this process for the second 20TB spinning hard drive (/dev/sdc).
    • sudo fdisk /dev/sdc
  3. Create Physical Volumes (PVs) on the two newly created partitions using the pvcreate command. For example:
    • sudo pvcreate /dev/sdb1 /dev/sdc1
  4. Create a Physical Volume Group (PVG) that includes the two new Physical Volumes using the vgcreate command. For example:
    • sudo vgcreate important_data_vg /dev/sdb1 /dev/sdc1
  5. Create two Logical Volumes (LVs) on the new Physical Volume Group using the lvcreate command. For example:
    • sudo lvcreate -n important_data_lv -L 25T important_data_vg
    • sudo lvcreate -n backup_data_lv -L 15T important_data_vg
    • This will create two new Logical Volumes called important_data_lv and backup_data_lv on the important_data_vg Physical Volume Group, with sizes of 25TB and 15TB, respectively.
  6. Format the new Logical Volumes with a filesystem using the mkfs command. For example:
    • sudo mkfs.ext4 /dev/mapper/important_data_vg-important_data_lv
    • sudo mkfs.ext4 /dev/mapper/important_data_vg-backup_data_lv
    • This will format the new Logical Volumes with the ext4 filesystem.
  7. Mount the new Logical Volumes to a directory using the mount command. For example:
    • sudo mkdir /mnt/important_data
    • sudo mkdir /mnt/backup_data
    • sudo mount /dev/mapper/important_data_vg-important_data_lv /mnt/important_data
    • sudo mount /dev/mapper/important_data_vg-backup_data_lv /mnt/backup_data
    • This will create two new mount points (/mnt/important_data and /mnt/backup_data) and mount the new Logical Volumes to them.
  8. Optionally, you can add the new mount points to the /etc/fstab file so that they are mounted automatically at boot time. For example:
    • sudo echo "/dev/mapper/important_data_vg-important_data_lv /mnt/important_data ext4 defaults 0 0" >> /etc/fstab
    • sudo echo "/dev/mapper/important_data_vg-backup_data_lv /mnt/backup_data ext4 defaults 0 0" >> /etc/fstab

After completing these steps, Alexa will have two new Logical Volumes mounted to /mnt/important_data and /mnt/backup_data

 

You should also read:

Stdout

How would I redirect the standard output of a command (useradd) to a file named useradd_output.txt? How would I redirect stderr of the…

Stderr 2

Describe all of the inputs ans outputs, incluing stderr, and show examples of how they can be used on a RHEL system. In…

Stderr

What is stderr, and please show an example of saving stderr to a file on a RHEL system. In Linux and Unix systems,…

PAM

What is PAM and what are the most important tasks I should have memorized to pass the PAM portions of a task-based exam…