Introduction
In this challenge, you will learn how to create and delete logical volumes on a Linux system. Logical volumes are a key component of Logical Volume Management (LVM), which provides a flexible way to manage storage on your system. By completing this challenge, you will gain practical experience in configuring local storage using LVM.
Create Logical Volumes
In this step, you will create a complete LVM setup. This involves initializing a physical disk for use by LVM, creating a volume group to pool the storage, and then carving out logical volumes from that pool.
Tasks
- Create a new physical volume (PV) on the
/dev/nvme1n1device. - Create a new volume group (VG) named
vg1using the physical volume you created. - Create two logical volumes (LVs) named
lv1andlv2within thevg1volume group, each with a size of 500 MB.
Requirements
- All operations should be performed in the
/home/labexdirectory or its subdirectories. - Use the
pvcreate,vgcreate, andlvcreatecommands to create the physical volume, volume group, and logical volumes, respectively. - The physical volume device, volume group name, and logical volume names should match the task requirements.
- The size of each logical volume should be 500 MB.
Hints
How can I approach this?
Use sudo for LVM commands. First initialize the secondary disk as an LVM physical volume, then create the volume group, and finally create each logical volume from that volume group.
Example
After you have successfully completed all the tasks, you can verify your work by running the sudo lvs command. The output should be similar to the following, showing your two new logical volumes, lv1 and lv2, each with a size of 500.00m within the vg1 volume group.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv1 vg1 -wi-a---- 500.00m
lv2 vg1 -wi-a---- 500.00m
Delete Logical Volumes
Now that you've created logical volumes, the next step is to learn how to remove them. This is a common administrative task when storage is no longer needed. You will remove the logical volumes you created in the previous step.
Tasks
- Delete the logical volume
lv1from thevg1volume group. - Delete the logical volume
lv2from thevg1volume group.
Requirements
- All operations should be performed in the
/home/labexdirectory or its subdirectories. - Use the
lvremovecommand to delete the logical volumes. - The names of the logical volumes to be deleted should match the task requirements.
Hints
How can I approach this?
Use sudo for LVM commands. The lvremove command can prompt for confirmation, so use an option that confirms removal automatically if you want a non-interactive command.
Example
After deleting the logical volumes, running the sudo lvs command should produce no output, or at least not show lv1 and lv2. This confirms that the logical volumes have been successfully removed from the vg1 volume group.
Summary
In this challenge, you learned how to create and delete logical volumes using Logical Volume Management (LVM) on a Linux system. You created a physical volume, a volume group, and two logical volumes, then deleted the two logical volumes. This hands-on experience will help you understand the process of managing storage using LVM, which is a key skill for RHCSA certification.



