Create and Delete Logical Volumes

LinuxLinuxBeginner
Practice Now

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.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/BasicSystemCommandsGroup(["`Basic System Commands`"]) linux/BasicSystemCommandsGroup -.-> linux/echo("`Text Display`") subgraph Lab Skills linux/echo -.-> lab-389445{{"`Create and Delete Logical Volumes`"}} end

Create Logical Volumes

Tasks

  • Create a new physical volume (PV) on the /dev/sdb device.
  • Create a new volume group (VG) named vg1 using the physical volume you created.
  • Create two logical volumes (LVs) named lv1 and lv2 within the vg1 volume group, each with a size of 500 MB.

Requirements

  • All operations should be performed in the /home/labex directory or its subdirectories.
  • Use the pvcreate, vgcreate, and lvcreate commands to create the physical volume, volume group, and logical volumes, respectively.
  • The names of the physical volume, volume group, and logical volumes should match the task requirements.
  • The size of each logical volume should be 500 MB.

Example

After completing the tasks, the output of lvs command should be similar to the following:

  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

Tasks

  • Delete the logical volume lv1 from the vg1 volume group.
  • Delete the logical volume lv2 from the vg1 volume group.

Requirements

  • All operations should be performed in the /home/labex directory or its subdirectories.
  • Use the lvremove command to delete the logical volumes.
  • The names of the logical volumes to be deleted should match the task requirements.

Example

After deleting the logical volumes, the output of lvs command should not show lv1 and lv2 anymore.

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.

Other Linux Tutorials you may like